@@ -163,10 +163,10 @@ function check_worker_state(w::Worker)
163163 else
164164 w. ct_time = time ()
165165 if myid () > w. id
166- t = @async exec_conn_func (w)
166+ t = Threads . @spawn exec_conn_func (w)
167167 else
168168 # route request via node 1
169- t = @async remotecall_fetch ((p,to_id) -> remotecall_fetch (exec_conn_func, p, to_id), 1 , w. id, myid ())
169+ t = Threads . @spawn remotecall_fetch ((p,to_id) -> remotecall_fetch (exec_conn_func, p, to_id), 1 , w. id, myid ())
170170 end
171171 errormonitor (t)
172172 wait_for_conn (w)
@@ -258,7 +258,7 @@ function start_worker(out::IO, cookie::AbstractString=readline(stdin); close_std
258258 else
259259 sock = listen (interface, LPROC. bind_port)
260260 end
261- errormonitor (@async while isopen (sock)
261+ errormonitor (Threads . @spawn while isopen (sock)
262262 client = accept (sock)
263263 process_messages (client, client, true )
264264 end )
290290
291291
292292function redirect_worker_output (ident, stream)
293- t = @async while ! eof (stream)
293+ t = Threads . @spawn while ! eof (stream)
294294 line = readline (stream)
295295 if startswith (line, " From worker " )
296296 # stdout's of "additional" workers started from an initial worker on a host are not available
@@ -329,7 +329,7 @@ function read_worker_host_port(io::IO)
329329 leader = String[]
330330 try
331331 while ntries > 0
332- readtask = @async readline (io)
332+ readtask = Threads . @spawn readline (io)
333333 yield ()
334334 while ! istaskdone (readtask) && ((time_ns () - t0) < timeout)
335335 sleep (0.05 )
@@ -430,7 +430,7 @@ if launching workers programmatically, execute `addprocs` in its own task.
430430
431431```julia
432432# On busy clusters, call `addprocs` asynchronously
433- t = @async addprocs(...)
433+ t = Threads.@spawn addprocs(...)
434434```
435435
436436```julia
@@ -496,13 +496,13 @@ function addprocs_locked(manager::ClusterManager; kwargs...)
496496 # call manager's `launch` is a separate task. This allows the master
497497 # process initiate the connection setup process as and when workers come
498498 # online
499- t_launch = @async launch (manager, params, launched, launch_ntfy)
499+ t_launch = Threads . @spawn launch (manager, params, launched, launch_ntfy)
500500
501501 @sync begin
502502 while true
503503 if isempty (launched)
504504 istaskdone (t_launch) && break
505- @async begin
505+ Threads . @spawn begin
506506 sleep (1 )
507507 notify (launch_ntfy)
508508 end
@@ -512,7 +512,7 @@ function addprocs_locked(manager::ClusterManager; kwargs...)
512512 if ! isempty (launched)
513513 wconfig = popfirst! (launched)
514514 let wconfig= wconfig
515- @async setup_launched_worker (manager, wconfig, launched_q)
515+ Threads . @spawn setup_launched_worker (manager, wconfig, launched_q)
516516 end
517517 end
518518 end
@@ -592,7 +592,7 @@ function launch_n_additional_processes(manager, frompid, fromconfig, cnt, launch
592592 wconfig. port = port
593593
594594 let wconfig= wconfig
595- @async begin
595+ Threads . @spawn begin
596596 pid = create_worker (manager, wconfig)
597597 remote_do (redirect_output_from_additional_worker, frompid, pid, port)
598598 push! (launched_q, pid)
@@ -706,11 +706,11 @@ function create_worker(manager, wconfig)
706706 join_message = JoinPGRPMsg (w. id, all_locs, PGRP. topology, enable_threaded_blas, isclusterlazy ())
707707 send_msg_now (w, MsgHeader (RRID (0 ,0 ), ntfy_oid), join_message)
708708
709- errormonitor (@async manage (w. manager, w. id, w. config, :register ))
709+ errormonitor (Threads . @spawn manage (w. manager, w. id, w. config, :register ))
710710 # wait for rr_ntfy_join with timeout
711711 timedout = false
712712 errormonitor (
713- @async begin
713+ Threads . @spawn begin
714714 sleep ($ timeout)
715715 timedout = true
716716 put! (rr_ntfy_join, 1 )
@@ -767,7 +767,7 @@ function check_master_connect()
767767 end
768768
769769 errormonitor (
770- @async begin
770+ Threads . @spawn begin
771771 start = time_ns ()
772772 while ! haskey (map_pid_wrkr, 1 ) && (time_ns () - start) < timeout
773773 sleep (1.0 )
@@ -1063,13 +1063,13 @@ function rmprocs(pids...; waitfor=typemax(Int))
10631063
10641064 pids = vcat (pids... )
10651065 if waitfor == 0
1066- t = @async _rmprocs (pids, typemax (Int))
1066+ t = Threads . @spawn _rmprocs (pids, typemax (Int))
10671067 yield ()
10681068 return t
10691069 else
10701070 _rmprocs (pids, waitfor)
10711071 # return a dummy task object that user code can wait on.
1072- return @async nothing
1072+ return Threads . @spawn nothing
10731073 end
10741074end
10751075
@@ -1252,7 +1252,7 @@ function interrupt(pids::AbstractVector=workers())
12521252 @assert myid () == 1
12531253 @sync begin
12541254 for pid in pids
1255- @async interrupt (pid)
1255+ Threads . @spawn interrupt (pid)
12561256 end
12571257 end
12581258end
0 commit comments