@no_escape is incompatible with Threads.@threads
vuthanho opened this issue · 1 comments
vuthanho commented
julia> function f1()
@no_escape begin
y = @alloc(Int,10)
Threads.@threads for val in y
println(val)
end
end
end
ERROR: LoadError: The `return` keyword is not allowed to be used inside the `@no_escape` macro
I have to nest the for
loop inside a function to trick it:
julia> function _f(y)
Threads.@threads for val in y
println(y)
end
end
_f (generic function with 1 method)
julia> function f2()
@no_escape begin
y = @alloc(Int,10)
_f(y)
end
end
f2 (generic function with 1 method)