Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Jan 25, 2025
1 parent f53f04c commit ddb8ad4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/remotecall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -667,11 +667,13 @@ All asynchronous remote calls return `Future`s and set the
value to the return value of the call upon completion.
"""
function put!(r::Future, v)
println("put!($(repr(r)), $(repr(v))) on thread $(Threads.threadid())")
if r.where == myid()
rid = remoteref_id(r)
rv = lookup_ref(rid)
isready(rv) && error("Future can be set only once")
@lock r.lock begin
println("lock acquired on thread $(Threads.threadid()) on worker $(myid())")
put!(rv, v) # this notifies the tasks waiting on the channel in fetch
set_future_cache(r, v) # set the cache before leaving the lock, so that the notified tasks already see it cached
end
Expand All @@ -691,6 +693,7 @@ function set_future_cache(r::Future, v)
end

function put_future(rid, v, caller)
println("put_future on thread $(Threads.threadid()) on worker $(myid())")
rv = lookup_ref(rid)
isready(rv) && error("Future can be set only once")
put!(rv, v)
Expand Down

0 comments on commit ddb8ad4

Please sign in to comment.