jorton 2004/06/14 15:24:56
Modified: include apr_thread_proc.h
. CHANGES
threadproc/unix thread.c
Log:
* 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>
Revision Changes Path
1.109 +5 -3 apr/include/apr_thread_proc.h
Index: apr_thread_proc.h
===================================================================
RCS file: /home/cvs/apr/include/apr_thread_proc.h,v
retrieving revision 1.108
retrieving revision 1.109
diff -d -w -u -r1.108 -r1.109
--- apr_thread_proc.h 14 Jun 2004 19:36:58 -0000 1.108
+++ apr_thread_proc.h 14 Jun 2004 22:24:55 -0000 1.109
@@ -204,7 +204,7 @@
/**
* Set if newly created threads should be created in detached state.
* @param attr The threadattr to affect
- * @param on Thread detach state on or off
+ * @param on Non-zero if detached threads should be created.
*/
APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr,
apr_int32_t on);
@@ -212,6 +212,8 @@
/**
* Get the detach state for this threadattr.
* @param attr The threadattr to reference
+ * @return APR_DETACH if threads are to be detached, or APR_NOTDETACH
+ * if threads are to be joinable.
*/
APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr);
1.473 +3 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.472
retrieving revision 1.473
diff -d -w -u -r1.472 -r1.473
--- CHANGES 14 Jun 2004 21:16:40 -0000 1.472
+++ CHANGES 14 Jun 2004 22:24:56 -0000 1.473
@@ -7,6 +7,9 @@
Changes with APR 1.0
+ *) Fix apr_threadattr_detach_set() on Mac OS X. PR 28472.
+ [INOUE Seiichiro <inoue ariel-networks.com>]
+
*) Change default inter-process locking mechanisms: POSIX semaphores
and pthread cross-process mutexes are not used by default; on
Solaris, fcntl locks are used by default. [Joe Orton]
1.60 +5 -3 apr/threadproc/unix/thread.c
Index: thread.c
===================================================================
RCS file: /home/cvs/apr/threadproc/unix/thread.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -d -w -u -r1.59 -r1.60
--- thread.c 14 Jun 2004 15:08:43 -0000 1.59
+++ thread.c 14 Jun 2004 22:24:56 -0000 1.60
@@ -57,18 +57,20 @@
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 {