Thread safety

From JPCT
Jump to: navigation, search

Thread safety

jPCT as well as jPCT-AE aren't thread safe. This means that you are not supposed to manipulate jPCT related instances (like instances of World, Object3D...) from outside the render thread/method once the rendering has been started (setup work can be done in any thread of cause).

Be careful with your mouse/key/touch event listeners and don't let them access jPCT instances directly, because they usually don't execute in the same thread as the rendering does. It's good practice to let the event handler methods just set some flags and evaluate them in the render thread or use some event queue that will be processed in the rendering thread.