Hi Torben, On Tue, Feb 23, 2010 at 6:55 PM, Torben Dannhauer < [email protected]> wrote:
> Thanks to all for your information, now I'm awar of scopedLock :) I used it > and rewrote my code to use it and now it works in XP AND vista. ( But I > don't know why, because it was strait forward, no path alternatives, just > lock, doing and unlock. ) > The ScopedLock is great because it makes the code much easier to develop as you know no matter how you exit the scope it was created in it will automatically unlock the mutex. This works with normal coding like when you add an if() return; block the code (which is a classic mistake with forgetting to call unlock) as well cases where you get C++ exceptions thrown, as even here the ScopedLock will get destructed and correctly unlock the mutex. As to whether either of these cases existed in your own code I can't say. Have a look through the OSG code base of ScopedLock and lock() and unlock(), you'll find lots of examples of ScopedLock which the low level methods are almost never called directly - as convenience and safety favour ScopedLock almost every time. Robert.
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

