From 4104490dc35efde58ad9e1b1c9af36318746c490 Mon Sep 17 00:00:00 2001 From: Emil Ljungskog Date: Sun, 14 Mar 2021 15:23:12 +0100 Subject: [PATCH] Make @maybe_threaded compatible with Julia < 1.5 --- src/LatinHypercubeSampling.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/LatinHypercubeSampling.jl b/src/LatinHypercubeSampling.jl index faff157..6bd6094 100644 --- a/src/LatinHypercubeSampling.jl +++ b/src/LatinHypercubeSampling.jl @@ -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