[vtkusers] Mutexlock::Trylock?

Sebastien Valette sebastien.valette at creatis.insa-lyon.fr
Wed Feb 13 05:55:14 EST 2008


Thank you very much. Indeed, subclassing the mutex lock (actually 
vtkCriticalSection) was very easy, with pthreads.

Sebastien

Sean McBride a écrit :
> 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.
>
>   




More information about the vtkusers mailing list