Skip to content

Commit

Permalink
Merge pull request #42167 from krynju/kr/distributed-ref-count-race
Browse files Browse the repository at this point in the history
[Distributed] increment RRef ID counter atomically
  • Loading branch information
vchuravy authored Sep 12, 2021
2 parents 211ed19 + df137dd commit 4805d54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stdlib/Distributed/src/Distributed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ function _require_callback(mod::Base.PkgId)
end
end

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

struct RRID
whence::Int
id::Int

RRID() = RRID(myid(),next_ref_id())
RRID(whence, id) = new(whence,id)
RRID() = RRID(myid(), next_ref_id())
RRID(whence, id) = new(whence, id)
end

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

2 comments on commit 4805d54

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

Please sign in to comment.