HELP! FreeBSD g++ multi-threaded application?

Loren James Rittle rittle@latour.rsch.comm.mot.com
Sun Apr 1 00:00:00 GMT 2001


In article < 3A6DFBB8.18C8C7EC@corp124.com >,
jeanniey@corp124.com writes:

>>> I know that libstdc++ is not thread safe.  Is there any way to get
>>> around that?  I am compiling with the -D_REENTRANT -D_THREAD_SAFE
>>> -D_PTHREADS -D__USE_MALLOC flags.  Is there something else I'm
>>> missing?

> I'm using
> 	gcc version 2.95.2 19991024 (release)
> this came with the FreeBSD 4.2 install packages.  I'm assuming that the
> libstdc++ library is also the same version?  

> the --enable-threads=posix is a build option for the compiler right?  I
> don't know what options the compiler was built with... since it came off
> the FreeBSD install.  Is there any way I can tell?

The system compiler on FreeBSD 4.2, as installed, is suppose to
support thread-safe operations.  However, that may or may not include
usage of some features out of the stdlibc++ without user-code-level
locking surrounding calls into the library.

> I am using the -pthreads linkage on the compile line.

If you can send me (off-list) a small test case that doesn't work for
you under FreeBSD, I'd be happy to comment on what you can do to fix
your problem.

Regards,
Loren


More information about the Libstdc++ mailing list