Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q: boost::shared_ptr and thread-safety

26 views
Skip to first unread message

Thomas Köhler

unread,
May 13, 2002, 8:37:36 AM5/13/02
to
Hi,

Im trying to port a multithreaded Win32 console application which uses
the boost::shared_ptr class (www.boost.org) to run under VxWorks
(Tornado 2.0.2, x86, gcc 2.7.2). Shared_ptr claims to be thread-safe for
Win32, Linux and "any platform that supports pThread".
But I explicitly DON'T want to use the pThread library for VxWorks
because of performance reasons.

My question now is:
How to make boost::shared_ptr thread-safe ?

MTIA

--
Thomas Köhler
ROVEMA * Tel +49 (0) 641 409-221
Verpackungsmaschinen GmbH * Fax +49 (0) 641 409-212
Industriestraße 1 * mailto:thomas....@rovema.de
Fernwald * http://www.rovema.de

John

unread,
May 13, 2002, 10:41:27 PM5/13/02
to
Hello,

> Im trying to port a multithreaded Win32 console application which uses
> the boost::shared_ptr class (www.boost.org) to run under VxWorks
> (Tornado 2.0.2, x86, gcc 2.7.2). Shared_ptr claims to be thread-safe for
> Win32, Linux and "any platform that supports pThread".
> But I explicitly DON'T want to use the pThread library for VxWorks
> because of performance reasons.

What performance reasons? The pthreads for VxWorks maps directly onto
the task layer, and shouldn't impose significant performance
penalties, especially not to a running thread (which is, after all,
just a VxWorks task).



> My question now is:
> How to make boost::shared_ptr thread-safe ?

Well, how are they ensuring this in the existing code? If it is
pthreads based, then I assume some type of mutex is in use somewhere.
That should be trivial to port to a VxWorks mutex. Try searching in
the tree for the pthread mutex APIs, that should give you a good idea
of where to look.

HTH,

John...

0 new messages