@@ -493,15 +493,13 @@ type Future <: AbstractRemoteRef
493
493
v:: Nullable{Any}
494
494
495
495
Future (w:: Int , rrid:: RRID ) = Future (w, rrid, Nullable {Any} ())
496
- Future (w:: Int , rrid:: RRID , v) = (r = new (w,rrid. whence,rrid. id,v); test_existing_ref (r))
496
+ Future (w:: Int , rrid:: RRID , v) = (r = new (w,rrid. whence,rrid. id,v); return test_existing_ref (r))
497
497
end
498
498
499
499
function finalize_future (f:: Future )
500
500
if f. where > 0
501
501
isnull (f. v) && send_del_client (f)
502
502
f. where = 0
503
- f. whence = 0
504
- f. id = 0
505
503
f. v = Nullable {Any} ()
506
504
end
507
505
f
@@ -512,7 +510,7 @@ type RemoteChannel{T<:AbstractChannel} <: AbstractRemoteRef
512
510
whence:: Int
513
511
id:: Int
514
512
515
- RemoteChannel (w:: Int , rrid:: RRID ) = (r = new (w, rrid. whence, rrid. id); test_existing_ref (r))
513
+ RemoteChannel (w:: Int , rrid:: RRID ) = (r = new (w, rrid. whence, rrid. id); return test_existing_ref (r))
516
514
end
517
515
518
516
function test_existing_ref (r:: Future )
@@ -527,25 +525,23 @@ function test_existing_ref(r::Future)
527
525
end
528
526
client_refs[r] = true
529
527
finalizer (r, finalize_future)
530
- r
528
+ return r
531
529
end
532
530
533
531
function test_existing_ref (r:: RemoteChannel )
534
532
found = getkey (client_refs, r, false )
535
533
! is (found,false ) && (client_refs[r] == true ) && return found
536
534
client_refs[r] = true
537
535
finalizer (r, finalize_remote_channel)
538
- r
536
+ return r
539
537
end
540
538
541
539
function finalize_remote_channel (r:: RemoteChannel )
542
540
if r. where > 0
543
541
send_del_client (r)
544
542
r. where = 0
545
- r. whence = 0
546
- r. id = 0
547
543
end
548
- r
544
+ return r
549
545
end
550
546
551
547
Future (w:: LocalProcess ) = Future (w. id)
@@ -614,18 +610,13 @@ end
614
610
615
611
del_client (id, client) = del_client (PGRP, id, client)
616
612
function del_client (pg, id, client)
617
- # As a workaround to issue https://github.com/JuliaLang/julia/issues/14445
618
- # the dict/set updates are executed asynchronously so that they do
619
- # not occur in the midst of a gc. The `@async` prefix must be removed once
620
- # 14445 is fixed.
621
- @async begin
622
- rv = get (pg. refs, id, false )
623
- if rv != false
624
- delete! (rv. clientset, client)
625
- if isempty (rv. clientset)
626
- delete! (pg. refs, id)
627
- # print("$(myid()) collected $id\n")
628
- end
613
+ rv = get (pg. refs, id, false )
614
+
615
+ if rv != false
616
+ delete! (rv. clientset, client)
617
+ if isempty (rv. clientset)
618
+ delete! (pg. refs, id)
619
+ # print("$(myid()) collected $id\n")
629
620
end
630
621
end
631
622
nothing
0 commit comments