@@ -163,10 +163,10 @@ function check_worker_state(w::Worker)
163
163
else
164
164
w. ct_time = time ()
165
165
if myid () > w. id
166
- t = Threads. @spawn exec_conn_func (w)
166
+ t = Threads. @spawn Threads . threadpool () exec_conn_func (w)
167
167
else
168
168
# route request via node 1
169
- t = Threads. @spawn remotecall_fetch ((p,to_id) -> remotecall_fetch (exec_conn_func, p, to_id), 1 , w. id, myid ())
169
+ t = Threads. @spawn Threads . threadpool () remotecall_fetch ((p,to_id) -> remotecall_fetch (exec_conn_func, p, to_id), 1 , w. id, myid ())
170
170
end
171
171
errormonitor (t)
172
172
wait_for_conn (w)
@@ -194,7 +194,7 @@ function wait_for_conn(w)
194
194
timeout = worker_timeout () - (time () - w. ct_time)
195
195
timeout <= 0 && error (" peer $(w. id) has not connected to $(myid ()) " )
196
196
197
- T = Threads. @spawn begin
197
+ T = Threads. @spawn Threads . threadpool () begin
198
198
sleep ($ timeout)
199
199
lock (w. c_state) do
200
200
notify (w. c_state; all= true )
@@ -329,7 +329,7 @@ function read_worker_host_port(io::IO)
329
329
leader = String[]
330
330
try
331
331
while ntries > 0
332
- readtask = Threads. @spawn readline (io)
332
+ readtask = Threads. @spawn Threads . threadpool () readline (io)
333
333
yield ()
334
334
while ! istaskdone (readtask) && ((time_ns () - t0) < timeout)
335
335
sleep (0.05 )
@@ -496,13 +496,13 @@ function addprocs_locked(manager::ClusterManager; kwargs...)
496
496
# call manager's `launch` is a separate task. This allows the master
497
497
# process initiate the connection setup process as and when workers come
498
498
# online
499
- t_launch = Threads. @spawn launch (manager, params, launched, launch_ntfy)
499
+ t_launch = Threads. @spawn Threads . threadpool () launch (manager, params, launched, launch_ntfy)
500
500
501
501
@sync begin
502
502
while true
503
503
if isempty (launched)
504
504
istaskdone (t_launch) && break
505
- Threads. @spawn begin
505
+ Threads. @spawn Threads . threadpool () begin
506
506
sleep (1 )
507
507
notify (launch_ntfy)
508
508
end
@@ -512,7 +512,7 @@ function addprocs_locked(manager::ClusterManager; kwargs...)
512
512
if ! isempty (launched)
513
513
wconfig = popfirst! (launched)
514
514
let wconfig= wconfig
515
- Threads. @spawn setup_launched_worker (manager, wconfig, launched_q)
515
+ Threads. @spawn Threads . threadpool () setup_launched_worker (manager, wconfig, launched_q)
516
516
end
517
517
end
518
518
end
@@ -592,7 +592,7 @@ function launch_n_additional_processes(manager, frompid, fromconfig, cnt, launch
592
592
wconfig. port = port
593
593
594
594
let wconfig= wconfig
595
- Threads. @spawn begin
595
+ Threads. @spawn Threads . threadpool () begin
596
596
pid = create_worker (manager, wconfig)
597
597
remote_do (redirect_output_from_additional_worker, frompid, pid, port)
598
598
push! (launched_q, pid)
@@ -1050,13 +1050,13 @@ function rmprocs(pids...; waitfor=typemax(Int))
1050
1050
1051
1051
pids = vcat (pids... )
1052
1052
if waitfor == 0
1053
- t = Threads. @spawn _rmprocs (pids, typemax (Int))
1053
+ t = Threads. @spawn Threads . threadpool () _rmprocs (pids, typemax (Int))
1054
1054
yield ()
1055
1055
return t
1056
1056
else
1057
1057
_rmprocs (pids, waitfor)
1058
1058
# return a dummy task object that user code can wait on.
1059
- return Threads. @spawn nothing
1059
+ return Threads. @spawn Threads . threadpool () nothing
1060
1060
end
1061
1061
end
1062
1062
@@ -1239,7 +1239,7 @@ function interrupt(pids::AbstractVector=workers())
1239
1239
@assert myid () == 1
1240
1240
@sync begin
1241
1241
for pid in pids
1242
- Threads. @spawn interrupt (pid)
1242
+ Threads. @spawn Threads . threadpool () interrupt (pid)
1243
1243
end
1244
1244
end
1245
1245
end
0 commit comments