[IGSTK-Users] (Micron)Tracker update problem

Vincent Gratsac vincent.gratsac at irisa.fr
Wed May 13 11:32:21 EDT 2009


Hi all,

I am currently faced to a "locking" problem when using the igstk 
MicronTracker class.

This class is multi-threaded :
    - on one side, a separated thread (#1) communicates with the 
tracking system by continuously updating tools informations into a 
buffer (ThreadedUpdateStatus method). This is made in an infinite loop.
    - on the other side, the principal thread (#0) reads informations 
from the buffer at a defined frequency, and affect it to TrackerTools 
objects.

In order to make this process thread-safe, an Itk MutexLock object is 
used. My problem is that the separated thread (#1) locks and unlocks 
this mutex many times without letting the principal thread locking it, 
for a quite long time (around 100 milliseconds).

This problem results in jerky effects on the user interface.

I think that this problem should also happen for other Tracker classes, 
since this behaviour is implemented in the main Tracker class.

To resolve this, I would suggest to insert a call to the sleep method in 
the infinite loop of the separated thread (at least 1 or 2 
milliseconds), in order to let the principal thread lock the buffer and 
update TrackerTools informations.

Did anyone also meet this problem before ?
Do you think my suggestion could be integrated to the igstk cvs repository ?

Thank you,

Vincent




More information about the IGSTK-Users mailing list