File tree Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -207,19 +207,23 @@ Equivalent to `Base.@async` on Julia <= v1.2, equivalent to
207207`Base.Threads.@spawn` on Julia >= v1.3.
208208"""
209209macro mt_async (expr)
210- # Code taken from Base.@async and Base.Threads.@spawn:
211- thunk = esc (:(()-> ($ expr)))
212- var = esc (Base. sync_varname)
213- quote
214- local task = Task ($ thunk)
215- @static if VERSION >= v " 1.3.0-alpha.0"
216- task. sticky = false
217- end
218- if $ (Expr (:isdefined , var))
219- push! ($ var, task)
210+ @static if VERSION >= v " 1.4.0"
211+ :(Base. Threads. @spawn $ (esc (expr)))
212+ else
213+ # Code taken from Base.@async and Base.Threads.@spawn:
214+ thunk = esc (:(()-> ($ expr)))
215+ var = esc (Base. sync_varname)
216+ quote
217+ local task = Task ($ thunk)
218+ @static if VERSION >= v " 1.3.0-alpha.0"
219+ task. sticky = false
220+ end
221+ if $ (Expr (:isdefined , var))
222+ push! ($ var, task)
223+ end
224+ schedule (task)
225+ task
220226 end
221- schedule (task)
222- task
223227 end
224228end
225229export @mt_async
You can’t perform that action at this time.
0 commit comments