Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2004-06-28 11:16:56

> The first problem is that the gcc option `-pthread' isn't documented
> for linux / x86. If you search
> then
> "pthread" is found only among the RS/6000 and PowerPC options. It's
> therefore always some guesswork what you can expect from gcc if you
> compile with pthread support. In particular, it's not documented how
> you can *detect* pthread support.
> IIUC POSIX does not (implicitly or explicitly) require any special
> compiler flags when you compile C code that uses a pthread
> implementation. I am not even sure whether it is strictly necessary to
> use the `-pthread' flag if you compile and link such code with gcc or
> whether it it is mainly a convenience option. (The situation may be
> different for C++ code if, e.g., the EH code is affected by the
> pthread support. But POSIX ignores C++, doesn't it?)
> If I am correct then POSIX cannot require any means to detect
> *activated* pthread support. I rather think it is a QoI defect of
> gcc 3.4.

As far as POSIX is concerned then checking for _POSIX_THREADS in unistd.h is
sufficient, and this probably is the case for C compilers, but as you say
for C++ this is not the case. BTW _REENTRANT isn't standardised anywhere:
it's just used informally by some Unix C/C++ compilers to indicate when
thread safe code generation is turned on, which makes gcc's decission to
define it in a header even more annoying.


Boost list run by bdawes at, gregod at, cpdaniel at, john at