I am hitting compile problems due to the interaction of Revision 65199 in apr/threadproc/unix/thread.c and
#define PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR.

Problem 1: Line int arg = DETACH_ARG(v);  where v is undefined.

patch to use the defined value on instead of undefined v


svn diff apr/threadproc/unix/thread.c
Index: apr/threadproc/unix/thread.c
===================================================================
--- apr/threadproc/unix/thread.c        (revision 494820)
+++ apr/threadproc/unix/thread.c        (working copy)
@@ -65,7 +65,7 @@
 {
     apr_status_t stat;
 #ifdef PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR
-    int arg = DETACH_ARG(v);
+    int arg = DETACH_ARG(on);

     if ((stat = pthread_attr_setdetachstate(&attr->attr, &arg)) == 0) {
 #else
====================================================================



Revision info for reference:
================================================================================
Revision 65199 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jun 14 22:24:56 2004 UTC (2 years, 6 months ago) by jorton
File length: 7792 byte(s)
Diff to previous 65195 (colored)

* 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>


--- apr/apr/trunk/threadproc/unix/thread.c    2004/06/14 15:08:43    65195
+++ apr/apr/trunk/threadproc/unix/thread.c    2004/06/14 22:24:56    65199
@@ -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 {
======================================================================================

Problem 2:
Constants PTHREAD_CREATE_DETACHED and PTHREAD_CREATE_JOINABLE are undefined in zOS, so I get undefines from:

#define DETACH_ARG(v) ((v) ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE)


So add something like this to apr/include/apr_thread_proc.c?:




Index: apr/include/apr_thread_proc.h
===================================================================
--- apr/include/apr_thread_proc.h       (revision 494820)
+++ apr/include/apr_thread_proc.h       (working copy)
@@ -212,6 +212,13 @@
  */
 APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr,
                                                     apr_int32_t on);
+#ifndef PTHREAD_CREATE_JOINABLE
+#define  PTHREAD_CREATE_JOINABLE 0
+#endif
+
+#ifndef PTHREAD_CREATE_DETACHED
+#define  PTHREAD_CREATE_DETACHED 1
+#endif

 /**
  * Get the detach state for this threadattr.


--
David Jones
oscaremma@gmail.com