|
Boost Users : |
From: John Maddock (john_maddock_at_[hidden])
Date: 2002-03-29 07:21:54
> Intriguing, as gcc-3.0.3 doesn't have a -pthread argument. I believe you
> specify the threading model with a configure argument when building gcc
now
> (although I just grabbed pre-built binaries, so I may be wrong).
I don't know about gcc3, but the way to tell is to do a
gcc -dumpspecs | less
and then search for "thread",
BTW gcc2.95 doesn't have -pthread either: it's spelt -pthreads, note the
trailing 's' it makes a difference!
For gcc 2.95 -pthreads is the same as:
CXXFLAGS=-D_REENTRANT -D_PTHREADS
LIBS=-lpthread
You are also correct that you have to specify the thread model when you
build gcc, that's a precondition for thread safe code, but it's not the end
of it, without -pthreads (which then defines _REENTRANT) your std lib
allocator won't be thread safe by default (at least on 2.95).
BTW I was also wrong about the #pragma implementation hack - it doesn't work
:-(
Evidently some of the functions from that header are in the std lib, and
some aren't, maybe the version of gcc I'm using wasn't built with thread
support, I don't know (I'm using the sourceforge compile farm for testing
this so I have no control over the gcc install). Whatever we're back to
square one on that one, although at least the release version of the thread
lib does work.
John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net