|
ccall(:jl_exit_threaded_region, Cvoid, ()) |
Interrupt could be throw during threading:
julia> function main()
Threads.@threads for i = 1:100
x = rand(100) .* rand(100)
sleep(1)
end
end
main (generic function with 1 method)
julia> main()
ERROR: InterruptException:
Stacktrace:
[1] try_yieldto(undo::typeof(Base.ensure_rescheduled))
@ Base .\task.jl:945
[2] wait()
@ Base .\task.jl:1009
[3] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)
@ Base .\condition.jl:130
[4] wait
@ .\condition.jl:125 [inlined]
[5] _wait(t::Task)
@ Base .\task.jl:317
[6] threading_run(fun::var"#37#threadsfor_fun#8"{var"#37#threadsfor_fun#7#9"{UnitRange{Int64}}}, static::Bool)
@ Base.Threads .\threadingconstructs.jl:167
[7] macro expansion
@ .\threadingconstructs.jl:220 [inlined]
[8] main()
@ Main .\REPL[7]:2
[9] top-level scope
@ REPL[8]:1
julia> ccall(:jl_in_threaded_region, Cint, ())
1
julia/base/threadingconstructs.jl
Line 193 in 0a546ea
Interrupt could be throw during threading: