diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2007-11-19 19:19:21 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2007-11-19 19:19:21 +0000 |
commit | 7b18108b17bd40c81ed9d623a821bd6e127b3f48 (patch) | |
tree | 862477f497b63d1156e0bfd0d0288ce795a1b78e /threadproc/unix | |
parent | c194bbeed0983201a65dd1645bf9fa0b7bec071e (diff) | |
download | libapr-7b18108b17bd40c81ed9d623a821bd6e127b3f48.tar.gz |
Simplify handling of z/OS pthread API nuances. Beyond the
simplification, it fixes a compile error in the call to
pthread_yield() on z/OS.
Submitted by: David Jones
I modified it slightly to use AC_DEFINE() as suggested
by jorton.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@596402 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/unix')
-rw-r--r-- | threadproc/unix/signals.c | 6 | ||||
-rw-r--r-- | threadproc/unix/thread.c | 24 |
2 files changed, 17 insertions, 13 deletions
diff --git a/threadproc/unix/signals.c b/threadproc/unix/signals.c index f44c3d785..46acc1d1f 100644 --- a/threadproc/unix/signals.c +++ b/threadproc/unix/signals.c @@ -422,7 +422,7 @@ APR_DECLARE(apr_status_t) apr_setup_signal_thread(void) } #else if ((rv = pthread_sigmask(SIG_SETMASK, &sig_mask, NULL)) != 0) { -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS rv = errno; #endif } @@ -448,7 +448,7 @@ APR_DECLARE(apr_status_t) apr_signal_block(int signum) } #else if ((rv = pthread_sigmask(SIG_BLOCK, &sig_mask, NULL)) != 0) { -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS rv = errno; #endif } @@ -475,7 +475,7 @@ APR_DECLARE(apr_status_t) apr_signal_unblock(int signum) } #else if ((rv = pthread_sigmask(SIG_UNBLOCK, &sig_mask, NULL)) != 0) { -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS rv = errno; #endif } diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c index 0d5c3e2af..5639ac706 100644 --- a/threadproc/unix/thread.c +++ b/threadproc/unix/thread.c @@ -29,7 +29,7 @@ static apr_status_t threadattr_cleanup(void *data) apr_status_t rv; rv = pthread_attr_destroy(&attr->attr); -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS if (rv) { rv = errno; } @@ -51,7 +51,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool_cleanup_null); return APR_SUCCESS; } -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS stat = errno; #endif @@ -68,7 +68,7 @@ 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 +#ifdef HAVE_ZOS_PTHREADS int arg = DETACH_ARG(on); if ((stat = pthread_attr_setdetachstate(&attr->attr, &arg)) == 0) { @@ -79,7 +79,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, return APR_SUCCESS; } else { -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS stat = errno; #endif @@ -110,7 +110,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, if (stat == 0) { return APR_SUCCESS; } -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS stat = errno; #endif @@ -127,7 +127,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, if (rv == 0) { return APR_SUCCESS; } -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS rv = errno; #endif return rv; @@ -180,7 +180,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, return APR_SUCCESS; } else { -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS stat = errno; #endif @@ -219,7 +219,7 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, return APR_SUCCESS; } else { -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS stat = errno; #endif @@ -231,7 +231,7 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) { apr_status_t stat; -#ifdef PTHREAD_DETACH_ARG1_ADDR +#ifdef HAVE_ZOS_PTHREADS if ((stat = pthread_detach(thd->td)) == 0) { #else if ((stat = pthread_detach(*thd->td)) == 0) { @@ -240,7 +240,7 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) return APR_SUCCESS; } else { -#ifdef PTHREAD_SETS_ERRNO +#ifdef HAVE_ZOS_PTHREADS stat = errno; #endif @@ -251,7 +251,11 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) APR_DECLARE(void) apr_thread_yield(void) { #ifdef HAVE_PTHREAD_YIELD +#ifdef HAVE_ZOS_PTHREADS + pthread_yield(NULL); +#else pthread_yield(); +#endif /* HAVE_ZOS_PTHREADS */ #else #ifdef HAVE_SCHED_YIELD sched_yield(); |