I usually use Julia in Jupyter. While using Threads.@spawn
, the threads of jupyter is occupied. Then, untie the whole task is finished, I can not do anything.
So, is there a way I can forbbidden Threads.@spawn using #1 threads?
Well, if there is just one Julia thread, it is this only thread that needs to do the work. Dropping the Threads.@spawn
is not going to help: the computation still needs to run somewhere.
Quite the opposite actually. If you start your IJulia kernel with multiple threads (see here), than @spawn
is going to be useful in having the computation run on a “worker thread”.
(You might want to check out ThreadPools.jl’s @tspawnat
(or @bthreads
) to actually enforce that the computation runs on a “worker thread” and not on the “master thread”.)
2 Likes
Thanks for you.