Skip to content

Commit

Permalink
Make @maybe_threaded compatible with Julia < 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
eljungsk committed Mar 14, 2021
1 parent 1bad069 commit 4104490
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/LatinHypercubeSampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ include("AudzeEglaisObjective.jl")
#make an @threads-equivalent that is a no-op if threading is not requested
#nesting @threads not possible due to https://github.com/JuliaLang/julia/issues/37691
macro maybe_threaded(flag, ex)
if VERSION < v"1.5"
tex = Threads._threadsfor(ex.args[1], ex.args[2])
else
tex = Threads._threadsfor(ex.args[1], ex.args[2], :default)
end
quote
if !$(esc(flag))
$(esc(ex))
else
$(Threads._threadsfor(ex.args[1], ex.args[2], :default))
$tex
end
end
end
Expand Down

0 comments on commit 4104490

Please sign in to comment.