Hi, I was starting to play with* Threads.@threads *and I noticed a strange behaviour when the macro is used together with *throw* and *ErrorException*:
| | |_| | | | (_| | | Version 0.5.0 (2016-09-19 18:14 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release |__/ | x86_64-pc-linux-gnu julia> a = zeros(10); julia> Threads.@threads for i = 1:10 a[i] = Threads.threadid() if 4 <= i <= 8 throw(ErrorException("My Error")) end end julia> a 10-element Array{Float64,1}: 1.0 1.0 1.0 2.0 0.0 0.0 3.0 0.0 4.0 4.0 julia> a = zeros(10); julia> Threads.@threads for i = 1:10 if 4 <= i <= 8 throw(ErrorException("My Error")) end a[i] = Threads.threadid() end julia> a 10-element Array{Float64,1}: 1.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 4.0 4.0 The loop isn't terminated with the error and there is not error message printed. When the *throw* is at the end of the loop body, the result looks strange and unpredictable. *Is this behaviour expected? * *Do I simply need to avoid using throw and threads together?* *Best,*