Is using Python threading still not safe with Panda3D 1.10?

If you want to use threading with Panda3D, it’s not recommended to use Python’s built-in threading modules, since you will most likely run into issues (for Panda3D is written in C++ and thus does not use the Python threading modules). However, Panda3D offers a threading implementation that is safe to use, by reimplementing Python’s “thread” and “threading” modules, these work the same as the Python built-in threading modules but are actually safe to use with Panda3D.

Is this still the case?
Reason I care is I have code written which is not dependent on the Panda3D library and only when GUI is needed on startup do the Panda modules get imported.

The notice all the way at the top is correct:

Panda3D is compiled by default to use “true” threading, which makes it safe to use Python threading interfaces (or any other threading library) in conjunction with or in lieu of Panda’s own built-in threading interfaces described below.

So, you don’t need to use the stuff in direct.stdpy, any other threading interface will work. Only if you were to recompile Panda in SIMPLE_THREADS mode would it become an issue.

1 Like