The embedding documentation says clearly that you can only use the functions jl_...()
from a single foreign thread in which you have called jl_init()
. The question is, has anything changed with respect this restriction in view of the introduction in 1.9 of jl_adopt_thread()
. Is a thread started by Julia equivalent to a foreign thread that has called jl_adopt_thread()
? Thanks very in advance.
I have been experimenting. Calling jl_adopt_thread()
in each foreign thread it allows me to call Julia functions in all threads without crashes and producing the expected results. Of course, the no observation of crashes does not imply that it would work correctly in more complicated cases.
I am also very interested in this feature since it will open a lot of possibilities for creating GUI applications using Julia as the back end.
The example I have been working is for the Geant4.jl package. The use case is for HEP experiments that do have a C++ simulation application already running in which all the callbacks are in C++, and they would like to replace them (or a least some part) with Julia functions to benefit from the Julia ecosystem and be more dynamic than C++. Here is the example I have been playing if you are interested.