You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function Base.push!(r::DArrayRefs, id::Tuple{Int,Int})
39
+
# Ensure id refers to a DArray created on this node
40
+
iffirst(id) !=myid()
41
+
throw(
42
+
ArgumentError(
43
+
lazy"`DArray` is not created on the current worker: Only `DArray`s created on worker $(myid()) can be stored in this set but the `DArray` was created on worker $(first(id))."))
44
+
end
45
+
@lock r.lock begin
46
+
returnpush!(r.data, id)
47
+
end
48
+
end
49
+
function Base.delete!(r::DArrayRefs, id::Tuple{Int,Int})
50
+
@lock r.lock delete!(r.data, id)
51
+
return r
7
52
end
8
53
54
+
# Global counter to generate a unique ID for each DArray
55
+
const DID = Threads.Atomic{Int}(1)
56
+
9
57
"""
10
58
next_did()
11
59
12
-
Produces an incrementing ID that will be used for DArrays.
13
-
"""
14
-
next_did
60
+
Increment a global counter and return a tuple of the current worker ID and the incremented
0 commit comments