Skip to content

Commit df137dd

Browse files
committed
fix
1 parent dba8a08 commit df137dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/Distributed/src/Distributed.jl

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

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

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

94-
RRID() = RRID(myid(),next_ref_id())
95-
RRID(whence, id) = new(whence,id)
94+
RRID() = RRID(myid(), next_ref_id())
95+
RRID(whence, id) = new(whence, id)
9696
end
9797

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

0 commit comments

Comments
 (0)