@@ -475,7 +475,7 @@ function addprocs_locked(manager::ClusterManager; kwargs...)
475
475
476
476
# References to launched workers, filled when each worker is fully initialized and
477
477
# has connected to all nodes.
478
- launched_q = Int[] # Asynchronously filled by the launch method
478
+ launched_q = Base . Lockable ( Int[]) # Asynchronously filled by the launch method
479
479
480
480
# The `launch` method should add an object of type WorkerConfig for every
481
481
# worker launched. It provides information required on how to connect
@@ -522,7 +522,7 @@ function addprocs_locked(manager::ClusterManager; kwargs...)
522
522
remote_do (set_valid_processes, pid, all_w)
523
523
end
524
524
525
- sort! (launched_q)
525
+ sort! (@lock launched_q launched_q[] )
526
526
end
527
527
528
528
function set_valid_processes (plist:: Array{Int} )
@@ -551,7 +551,7 @@ default_addprocs_params() = Dict{Symbol,Any}(
551
551
552
552
function setup_launched_worker (manager, wconfig, launched_q)
553
553
pid = create_worker (manager, wconfig)
554
- push! (launched_q, pid)
554
+ @lock launched_q push! (launched_q[] , pid)
555
555
556
556
# When starting workers on remote multi-core hosts, `launch` can (optionally) start only one
557
557
# process on the remote machine, with a request to start additional workers of the
@@ -589,7 +589,7 @@ function launch_n_additional_processes(manager, frompid, fromconfig, cnt, launch
589
589
Threads. @spawn Threads. threadpool () begin
590
590
pid = create_worker (manager, wconfig)
591
591
remote_do (redirect_output_from_additional_worker, frompid, pid, port)
592
- push! (launched_q, pid)
592
+ @lock launched_q push! (launched_q[] , pid)
593
593
end
594
594
end
595
595
end
0 commit comments