[vtkusers] Mutexlock::Trylock?

Sean McBride sean at rogue-research.com
Mon Feb 11 16:54:25 EST 2008


On 2/11/08 6:04 PM, Sebastien Valette said:

>I am experimenting multithreaded computing, and I face a performance 
>issue due to my locking scheme. In this context, I think a method such 
>as vtkMutexLock::Trylock() would solve (at least partially) my problem. 
>Basically, trylock tries to acquire one lock and returns a value 
>depending on the success of the lock acquisition (without blocking the 
>thread). This method does not exist in the vtkMutexLock class.
>
>Does anyone know what is the most easy thing to do if I want such a 
>feature? Is an extension of the vtkMutexLock class possible?

You could probably subclass vtkMutexLock, or, since you're just
"experimenting", you could change vtkMutexLock itself.  You don't say
which OS you are using, but pthreads provide a pthread_mutex_trylock() API.

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the vtkusers mailing list