> Guarding against mulitple lock and unlocks being called by
> the same thread is what ReentrantMutex is all about. It
> avoids the mulitple lock so only ever needs to do one unlock.
> OpenThreads::Mutex is designed not to be reentrant so this
> type of usage is not safe, so it should be ok not worry about
> trying to match th EntrerCriticalSection/LeaveCriticalSection.
In that case, the CRITICAL_SECTION version is trivial and should be
efficient and clean.
This is waht others do, but I think we should stick with our implementation
1) because is faster
2) beacuse it worked until now
Any guidance on trylock()? From my previous email...
> > I'm also unsure of what the semantics and return code should be for
> > trylock():
> > * Should this function take the lock if it can? What should the
> > return code be in this case?
trylock try to takes a lock but if it fails it returns false insetd of blocking.
> > * If the current thread can't take the lock, what should
> the return
> > code be?
false
> > * Finally, if the current thread already owns the lock,
> what should
> > the return code be?
false with normal mutex, it should take the lock with reentrant mutex.
--
Boris
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/