From: Jarkko Hietaniemi Date: Mon, 2 Nov 1998 12:03:08 +0000 (+0000) Subject: Replace ATTR_JOINABLE with true Configure probe X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=136666271df3fddb92143e6fabf3bda463294b22;p=p5sagit%2Fp5-mst-13.2.git Replace ATTR_JOINABLE with true Configure probe for PTHREAD_CREATE_JOINABLE (or equivalent: PTHREAD_CREATE_UNDETACHED or __UNDETACHED). Remove ATTR_JOINABLE itself: Thread.xs uses PTHREAD_CREATE_JOINABLE (or equivalent) directly. Really scan for only if usethreads. p4raw-id: //depot/cfgperl@2181 --- diff --git a/Configure b/Configure index f0c31da..d6e9555 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Wed Oct 28 11:58:44 EET 1998 [metaconfig 3.0 PL70] +# Generated on Mon Nov 2 13:57:54 EET 1998 [metaconfig 3.0 PL70] # (with additional metaconfig patches by jhi@iki.fi) cat >/tmp/c1$$ <&4 + $cat >try.c <<'EOCP' +#include +int main() { + int detachstate = JOINABLE; +} +EOCP + set try -DJOINABLE=PTHREAD_CREATE_JOINABLE + if eval $compile; then + echo "You seem to use PTHREAD_CREATE_JOINABLE." >&2 + val="$undef" + set d_pthread_create_joinable + eval $setvar + val=0 + set pthread_create_joinable + eval $setvar + else + set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED + if eval $compile; then + echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&2 + val="$define" + set d_pthread_create_joinable + eval $setvar + val=PTHREAD_CREATE_UNDETACHED + set pthread_create_joinable + eval $setvar + else + set try -DJOINABLE=__UNDETACHED + if eval $compile; then + echo "You seem to use __UNDETACHED." >&2 + val="$define" + set d_pthread_create_joinable + eval $setvar + val=__UNDETACHED + set pthread_create_joinable + eval $setvar + else + echo "Egads, nothing obvious found. Guessing that you use 0." >&2 + val="$define" + set d_pthread_create_joinable + eval $setvar + val=0 + set pthread_create_joinable + eval $setvar + fi + fi + fi + $rm -f try try.* +else + d_pthread_create_joinable="$undef" + pthread_create_joinable=0 +fi + : see whether the various POSIXish _yields exist $cat >try.c <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #define ARCHNAME "$archname" /**/ +/* PTHREAD_CREATE_JOINABLE: + * This symbol, if defined, indicates how to create pthread + * in joinable (aka undetached) state. Not defined here if + * pthread.h already has defined PTHREAD_CREATE_JOINABLE. + * If defined, possible values are PTHREAD_CREATE_UNDETACHED + * and __UNDETACHED. + */ +#$d_pthread_create_joinable PTHREAD_CREATE_JOINABLE $pthread_create_joinable /**/ + /* HAS_PTHREAD_YIELD: * This symbol, if defined, indicates that the pthread_yield * routine is available to yield the execution of the current diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs index 208daf2..fb9aba9 100644 --- a/ext/Thread/Thread.xs +++ b/ext/Thread/Thread.xs @@ -229,7 +229,7 @@ newthread (SV *startsv, AV *initargs, char *classname) static pthread_attr_t attr; static int attr_inited = 0; sigset_t fullmask, oldmask; - static int attr_joinable = ATTR_JOINABLE; + static int attr_joinable = PTHREAD_CREATE_JOINABLE; #endif savethread = thr; diff --git a/thread.h b/thread.h index 8e95b98..1312b30 100644 --- a/thread.h +++ b/thread.h @@ -128,16 +128,6 @@ struct perl_thread *getTHR _((void)); # endif #endif -#if !defined(ATTR_JOINABLE) && defined(PTHREAD_CREATE_JOINABLE) -# define ATTR_JOINABLE PTHREAD_CREATE_JOINABLE -#endif -#if !defined(ATTR_JOINABLE) && defined(PTHREAD_CREATE_UNDETACHED) -# define ATTR_JOINABLE PTHREAD_CREATE_UNDETACHED -#endif -#if !defined(ATTR_JOINABLE) && defined(__UNDETACHED) -# define ATTR_JOINABLE __UNDETACHED -#endif - #ifndef MUTEX_INIT #define MUTEX_INIT(m) \ STMT_START { \