Skip to content

Commit e825fc5

Browse files
krynjuKristofferC
authored andcommitted
fix
(cherry picked from commit 90d857f)
1 parent 25b41a2 commit e825fc5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Distributed.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ function _require_callback(mod::Base.PkgId)
8383
end
8484
end
8585

86-
const REF_ID = Ref(1)
87-
next_ref_id() = (id = REF_ID[]; REF_ID[] = id+1; id)
86+
const REF_ID = Threads.Atomic{Int}(1)
87+
next_ref_id() = Threads.atomic_add!(REF_ID, 1)
8888

8989
struct RRID
9090
whence::Int
9191
id::Int
9292

93-
RRID() = RRID(myid(),next_ref_id())
94-
RRID(whence, id) = new(whence,id)
93+
RRID() = RRID(myid(), next_ref_id())
94+
RRID(whence, id) = new(whence, id)
9595
end
9696

9797
hash(r::RRID, h::UInt) = hash(r.whence, hash(r.id, h))

0 commit comments

Comments
 (0)