Skip to content

Commit 0deb6bb

Browse files
committed
Revert "Simplify implementation of mt_async for Julia >= v1.4"
This reverts commit c15e0f9.
1 parent 40aa8d8 commit 0deb6bb

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/onthreads.jl

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -207,23 +207,19 @@ Equivalent to `Base.@async` on Julia <= v1.2, equivalent to
207207
`Base.Threads.@spawn` on Julia >= v1.3.
208208
"""
209209
macro mt_async(expr)
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
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)
226220
end
221+
schedule(task)
222+
task
227223
end
228224
end
229225
export @mt_async

0 commit comments

Comments
 (0)