[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gcc -pthread should define _REENTRANT?



On Sunday 26 October 2003 02:09, Steve M. Robbins wrote:
> Hi,
>
> I need some advice: how should one detect that the "-pthread"
> flag has been used?  Boost looks for one of the two preprocessor
> symbols to be defined:
>
> 	_REENTRANT
> 	_PTHREADS
>
> That strategy seems to work for 6 of 11 architectures.  However, boost
> fails to build on: alpha, s390, ia64, hppa, and arm.  On the
> architectures for which I could find a sid chroot, I verified that
> _REENTRANT is not defined (gcc -x c /dev/null -E -dM -pthread | grep REENT)
>
> Do these architectures support pthreads or not?  If so, do they define
> a magic preprocessor symbol?
>
You cant be sure there is a -pthread option for all architectures as it is an 
architecture specific option. On some it is called -pthreads, and on others 
they only have -threads or none at all. (e.g. HP-UX 9 only has DEC-threads 
and not real pthreads). Rather you should use -D_REENTRANT -lpthreads, which 
is what it expands to anyway.

`Allan



Reply to: