[vtkusers] Multi threading question

Anton Deguet anton.deguet at jhu.edu
Mon Feb 23 22:51:22 EST 2009


Hello,

I have an application with one renderer and multiple actors.  Each actor (assembly) is controlled by a different thread and all use a single renderer (running in its own thread).  As a temporary solution, I use an application wide mutex lock/unlock for any access to VTK to avoid rendering while a thread is modifying the scene via its actor (threads can modify anything; position, size, visibility, opacity, texture, ... and other non atomic operations).  It somewhat works but I am afraid one programmer might forget to lock/unlock the scene before modifying its actors and this might be hard to debug/detect.  I am also slightly concerned by long waiting periods to lock the mutex as the application is growing.

So, does VTK provide something better than what I am using, i.e. is there any build-in thread safety mechanism that one can use (multiple buffers, queued commands, ...) that would avoid locks.

Thank you,

Anton Deguet



More information about the vtkusers mailing list