summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xConfigure72
-rw-r--r--config_h.SH9
-rw-r--r--ext/Thread/Thread.xs2
-rw-r--r--thread.h10
4 files changed, 79 insertions, 14 deletions
diff --git a/Configure b/Configure
index f0c31da387..d6e95555ff 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$$ <<EOF
@@ -409,6 +409,8 @@ d_pause=''
d_pipe=''
d_poll=''
d_portable=''
+d_pthread_create_joinable=''
+pthread_create_joinable=''
d_pthread_yield=''
d_sched_yield=''
sched_yield=''
@@ -8176,6 +8178,62 @@ eval $inlibc
set poll d_poll
eval $inlibc
+: how to create joinable pthreads
+if test "X$usethreads" = "X$define"; then
+ echo " "
+ echo "Checking what constant to use for creating joinable pthreads..." >&4
+ $cat >try.c <<'EOCP'
+#include <pthread.h>
+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 <<EOP
@@ -11382,8 +11440,14 @@ set locale.h i_locale
eval $inhdr
: see if mach cthreads are available
-set mach/cthreads.h i_machcthr
-eval $inhdr
+if test "X$usethreads" = "X$define"; then
+ set mach/cthreads.h i_machcthr
+ eval $inhdr
+else
+ i_machcthr="$undef"
+fi
+
+
: see if this is a math.h system
set math.h i_math
@@ -12299,6 +12363,7 @@ d_phostname='$d_phostname'
d_pipe='$d_pipe'
d_poll='$d_poll'
d_portable='$d_portable'
+d_pthread_create_joinable='$d_pthread_create_joinable'
d_pthread_yield='$d_pthread_yield'
d_pwage='$d_pwage'
d_pwchange='$d_pwchange'
@@ -12604,6 +12669,7 @@ prefixexp='$prefixexp'
privlib='$privlib'
privlibexp='$privlibexp'
prototype='$prototype'
+pthread_create_joinable='$pthread_create_joinable'
ptrsize='$ptrsize'
randbits='$randbits'
randfunc='$randfunc'
diff --git a/config_h.SH b/config_h.SH
index bfdb62a8a7..878fd1b454 100644
--- a/config_h.SH
+++ b/config_h.SH
@@ -2267,6 +2267,15 @@ sed <<!GROK!THIS! >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 208daf2236..fb9aba9d92 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 8e95b980db..1312b300dc 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 { \