Hi Torben,
Torben Dannhauer wrote:
Hi,
I have to secure a std::vector for multithreaded access and used a
Reentrant Mutex for this.
(btw: Whats the diferent between reentrant mutex and mutex?)
reentrant mutex can be locked multiple times from the same thread,
standard mutex cannot.
On my development Platform (Vista) this works great. On windows XP 32
bit, the application hangs on this mutex, although it is not locked.
This is a bit strange, cos on Windows the default is reentrant. Have you
compiled your app from scratch on both platforms?
What is the best way to secure access to a std::vector which should
run on all platforms?
You could have a look at Intel threading building blocks (TBB), they
have a concurrent vector. Boost has some sync primitives in thread lib.
OpenThreads should also work though. Also, what are you storing in the
vector?
I' have seen this scopedLock is often used, by I have no clue what
this is about and how it works.
Scoped lock takes a mutex when constructed and releases it when
destructed (RAII). In this way you don't have to manually call unlock on
all different exit paths from a certain scope.
Has anybody an idea where to get further information?
Boost docs, pthread docs, tbb docs or just ask more questions :)
jp
Thank you!
Cheers, Torbenand Wind
------------------ Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=24697#24697
_______________________________________________ osg-users mailing
list [email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org