Hi Paul,

 

The difference is that ReentrantMutex will not block if the caller is
already holding the mutex and is trying to lock() it again (there is a lock
count maintained); you can therefore nest calls to routines using this type
of mutex without fear of self-deadlocking the caller. With Mutex you get no
such behaviour (although the implementation may actually use an OS
synchronization object that allows it – I believe this is the case for
Windows but could be wrong).

 

Hope this helps,

 

André

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Martz
Sent: November-30-07 11:45 AM
To: 'OpenSceneGraph Users'
Subject: [osg-users] Mutex and ReentrantMutex

 

(Temporary brain cramp, because I know I knew this at one point...)

 

Can someone explain the difference between Mutex and ReentrantMutex? The
code comments are practically non-existent, the code itself seems somewhat
un-illuminating, and the ChangeLog just says things like "Added
ReentrantMutex to fix Font problems" but doesn't explain what the problem
was, or how ReentrantMutex fixed the problem and why Mutex couldn't fix the
problem.

 

Essentially, I'm not sure why I would choose to use one class over the
other.

 

Any info would be appreciated.

 

Paul Martz

Skew Matrix Software LLC

http://www.skew-matrix.com <http://www.skew-matrix.com/> 

303 859 9466

 

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to