So what I want is to make 2 threads from Godot at a certain time. break them out of their running loop when a method is called and in this method call the C++ join method.
Can I run a Godot thread in my GDNative and terminate (join) it in C++
- Edited
It may be possible, but I got weird results with using standard C++ threading in add-ons. What I ended up doing was spawning a thread in GDScript, and then calling my C++ function from there, which seemed to work better. Also, threads joining themselves is really error prone. It's best to use some sort of atomic or outside check to see if the results are done, and then join from the main thread (e.g. in GDScript).