@@ -85,7 +85,7 @@ function schedule_call(rid, thunk)
8585 rv = RemoteValue (def_rv_channel ())
8686 (PGRP:: ProcessGroup ). refs[rid] = rv
8787 push! (rv. clientset, rid. whence)
88- errormonitor (@async run_work_thunk (rv, thunk))
88+ errormonitor (Threads . @spawn run_work_thunk (rv, thunk))
8989 return rv
9090 end
9191end
118118
119119# # message event handlers ##
120120function process_messages (r_stream:: TCPSocket , w_stream:: TCPSocket , incoming:: Bool = true )
121- errormonitor (@async process_tcp_streams (r_stream, w_stream, incoming))
121+ errormonitor (Threads . @spawn process_tcp_streams (r_stream, w_stream, incoming))
122122end
123123
124124function process_tcp_streams (r_stream:: TCPSocket , w_stream:: TCPSocket , incoming:: Bool )
@@ -148,7 +148,7 @@ Julia version number to perform the authentication handshake.
148148See also [`cluster_cookie`](@ref).
149149"""
150150function process_messages (r_stream:: IO , w_stream:: IO , incoming:: Bool = true )
151- errormonitor (@async message_handler_loop (r_stream, w_stream, incoming))
151+ errormonitor (Threads . @spawn message_handler_loop (r_stream, w_stream, incoming))
152152end
153153
154154function message_handler_loop (r_stream:: IO , w_stream:: IO , incoming:: Bool )
@@ -283,7 +283,7 @@ function handle_msg(msg::CallMsg{:call}, header, r_stream, w_stream, version)
283283 schedule_call (header. response_oid, ()-> invokelatest (msg. f, msg. args... ; msg. kwargs... ))
284284end
285285function handle_msg (msg:: CallMsg{:call_fetch} , header, r_stream, w_stream, version)
286- errormonitor (@async begin
286+ errormonitor (Threads . @spawn begin
287287 v = run_work_thunk (()-> invokelatest (msg. f, msg. args... ; msg. kwargs... ), false )
288288 if isa (v, SyncTake)
289289 try
@@ -299,15 +299,15 @@ function handle_msg(msg::CallMsg{:call_fetch}, header, r_stream, w_stream, versi
299299end
300300
301301function handle_msg (msg:: CallWaitMsg , header, r_stream, w_stream, version)
302- errormonitor (@async begin
302+ errormonitor (Threads . @spawn begin
303303 rv = schedule_call (header. response_oid, ()-> invokelatest (msg. f, msg. args... ; msg. kwargs... ))
304304 deliver_result (w_stream, :call_wait , header. notify_oid, fetch (rv. c))
305305 nothing
306306 end )
307307end
308308
309309function handle_msg (msg:: RemoteDoMsg , header, r_stream, w_stream, version)
310- errormonitor (@async run_work_thunk (()-> invokelatest (msg. f, msg. args... ; msg. kwargs... ), true ))
310+ errormonitor (Threads . @spawn run_work_thunk (()-> invokelatest (msg. f, msg. args... ; msg. kwargs... ), true ))
311311end
312312
313313function handle_msg (msg:: ResultMsg , header, r_stream, w_stream, version)
@@ -350,7 +350,7 @@ function handle_msg(msg::JoinPGRPMsg, header, r_stream, w_stream, version)
350350 # The constructor registers the object with a global registry.
351351 Worker (rpid, ()-> connect_to_peer (cluster_manager, rpid, wconfig))
352352 else
353- @async connect_to_peer (cluster_manager, rpid, wconfig)
353+ Threads . @spawn connect_to_peer (cluster_manager, rpid, wconfig)
354354 end
355355 end
356356 end
0 commit comments