summaryrefslogtreecommitdiff
path: root/threadproc/unix
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2004-06-14 22:24:56 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2004-06-14 22:24:56 +0000
commitcfb770305876762fed3f81e3536f485c7a75f318 (patch)
tree21c165ccaf9b0e77b13e0192ae70e48b9ac81b22 /threadproc/unix
parentd96c82b6be75f255dc4e6914c3a2e59fb35deb96 (diff)
downloadlibapr-cfb770305876762fed3f81e3536f485c7a75f318.tar.gz
* threadproc/unix/thread.c (apr_threadattr_detach_set): Fix for Mac OS
X: pass valid arguments to pthread_attr_setdetachstate. * include/apr_thread_proc.h: Clarify apr_threadattr_detach_{set,get} interfaces. PR: 28472 Submitted by: INOUE Seiichiro <inoue ariel-networks.com> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@65199 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/unix')
-rw-r--r--threadproc/unix/thread.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c
index 68faebeaa..ef0aa21b9 100644
--- a/threadproc/unix/thread.c
+++ b/threadproc/unix/thread.c
@@ -57,18 +57,20 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new,
return stat;
}
+#define DETACH_ARG(v) ((v) ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE)
+
APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr,
apr_int32_t on)
{
apr_status_t stat;
#ifdef PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR
- int arg = on;
+ int arg = DETACH_ARG(v);
if ((stat = pthread_attr_setdetachstate(&attr->attr, &arg)) == 0) {
#else
- if ((stat = pthread_attr_setdetachstate(&attr->attr, on)) == 0) {
+ if ((stat = pthread_attr_setdetachstate(&attr->attr,
+ DETACH_ARG(on))) == 0) {
#endif
-
return APR_SUCCESS;
}
else {