Skip to content

Commit

Permalink
Update stdlib/Distributed/src/remotecall.jl
Browse files Browse the repository at this point in the history
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
  • Loading branch information
krynju and vtjnash authored Nov 20, 2021
1 parent 83ecafa commit 67da4d5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions stdlib/Distributed/src/remotecall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,22 @@ end
channel_type(rr::RemoteChannel{T}) where {T} = T

function serialize(s::ClusterSerializer, f::Future)
v_cache = @atomic f.v
serialize(s, f, v_cache === nothing)
serialize_type(s, typeof(f))
serialize(s, f.where)
serialize(s, remoteref_id(f))
value = @atomic f.v
if value === nothing
p = worker_id_from_socket(s.io)
(p !== rr.where) && send_add_client(rr, p)
end
serialize(s, value)
end
function serialize(s::ClusterSerializer, f::RemoteChannel)
p = worker_id_from_socket(s.io)
(p !== rr.where) && send_add_client(rr, p)
invoke(serialize, Tuple{AbstractSerializer, Any}, s, f)
end
serialize(s::ClusterSerializer, rr::RemoteChannel) = serialize(s, rr, true)
function serialize(s::ClusterSerializer, rr::AbstractRemoteRef, addclient)
if addclient
serialize(s::AbstractSerializer, ::AbstractLock) = error("Locks cannot be serialized")
p = worker_id_from_socket(s.io)
(p !== rr.where) && send_add_client(rr, p)
end
Expand Down

0 comments on commit 67da4d5

Please sign in to comment.