Build requirements for threaded code?
John Reiser
jreiser at bitwagon.com
Thu Aug 20 05:24:45 UTC 2009
On 08/19/2009 07:57 PM, Roland McGrath wrote:
> -pthread means -D_REENTRANT and -lpthread. -D_REENTRANT is basically
> useless and you should use standard feature test macros or _GNU_SOURCE for
> what you want. So just linking with -lpthread is what I would call the
> normal and recommended practice.
On current Fedora with gcc+glibc(NativePosixThreadLibrary) this works today
and has for some years. On some predecessor systems "gxx -pthread"
was required for both compiling and linking. [gxx means gcc or g++.]
On non-NPTL or non-Linux systems it may still be required today.
Perhaps it may be required on future Fedora.
Using "gxx -pthread" always is safe. At least, making it safe is a well-
known part of the job of the maintainer of gxx. Using just "-lpthread"
means that the user _assumes_ that compilation is independent of threading,
or already has taken threading into account.
--
More information about the fedora-devel-list
mailing list