Pthreads: Difference between revisions
| Line 94: | Line 94: | ||
off to dig through gcc source....</pre>Nonetheless, this is a poorly-documented gcc-specific method; best to always provide -D_REENTRANT explicitly. -D_REENTRANT and other preprocessor directives which affect code selection should always precede -include options to gcc, ie:<pre>gcc -D_REENTRANT -I/usr/local -include pthread.h ...</pre> | off to dig through gcc source....</pre>Nonetheless, this is a poorly-documented gcc-specific method; best to always provide -D_REENTRANT explicitly. -D_REENTRANT and other preprocessor directives which affect code selection should always precede -include options to gcc, ie:<pre>gcc -D_REENTRANT -I/usr/local -include pthread.h ...</pre> | ||
On FreeBSD's libc (and also possibly with regard to other third-part libraries), it's also necessary to define _THREAD_SAFE, as evidenced below (furthermore, you need _POSIX_PTHREAD_SEMANTICS and _P1003_1B_VISIBLE for reasons I determined long ago and have since forgotten, see the [[GNU | On FreeBSD's libc (and also possibly with regard to other third-part libraries), it's also necessary to define _THREAD_SAFE, as evidenced below (furthermore, you need _POSIX_PTHREAD_SEMANTICS and _P1003_1B_VISIBLE for reasons I determined long ago and have since forgotten, see the [[GNU Make|make]] snippet below --''dank''):<pre>Newsgroups: sys.research.subversion.repper | ||
From: Nick Black <nblack@securecomputing.com> | From: Nick Black <nblack@securecomputing.com> | ||
Subject: Re: [repper-304] REENTRANT is required by POSIX for any code using pthr | Subject: Re: [repper-304] REENTRANT is required by POSIX for any code using pthr | ||