Thread Safety

The ParticleDatasetReader and PtfxDatasetWriter classes are internally synchronized with a mutex, making them safe to call from multiple threads concurrently. Common multi-threaded patterns include:

  • Reading frames on a background thread while the main thread renders
  • Calling preloadFrames() from a background thread
  • Writing frames from a producer thread while another thread continues simulation

Note

ParticleModel itself must be accessed from the rendering thread (or with external synchronization), as it interacts with OpenGL state. Only the reader and writer are thread-safe internally.