in trunk Revision 418351 introduced a pthread_yield() call, on zOS, however pthread_yield has to be passed in a null arg, i.e. pthread_yield(NULL)
I've added further checking to 418351's patch to do a
APR_TRY_COMPILE_NO_WARNING, to see if pthread_yield needs be called with ()
or (NULL) args. Patch let zOS and linux compile correctly, but
didn't try other platforms.
These comments in apr_common.m4 got me if its safe though:
dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY,
dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS])
dnl
dnl Tries a compile test with warnings activated so that the result
dnl is false if the code doesn't compile cleanly. For compilers
dnl where it is not known how to activate a "fail-on-error" mode,
dnl it is undefined which of the sets of actions will be run.
so is patch below good enough, or do I need to be safer, ex:
ac_try_compile of pthread_yield() if works -> has_null_arg =no
else apr_try_compile_no_warningsof pthread_yield(0) if works ->
has_null_arg =yes
else has_null_arg = no
(or i could punt and add -DPTHREAD_YIELD_HAS_NULL_ARG to os390 leg in
apr_hints.m4)
Index: configure.in
===================================================================
--- configure.in (revision 594913)
+++ configure.in (working copy)
@@ -674,6 +674,14 @@
dnl ----------------------------- Checking for sched_yield
AC_CHECK_HEADERS([sched.h])
AC_CHECK_FUNCS([sched_yield])
+ else
+ AC_CACHE_CHECK([for pthread_yield args],
[apr_cv_pthread_yield_has_null_arg],
+ APR_TRY_COMPILE_NO_WARNING([#include <pthread.h>],
+ [pthread_yield(0);],
+ [apr_cv_pthread_yield_has_null_arg=yes],
[apr_cv_pthread_yield_has_null_arg=no]))
+ if test "$apr_cv_pthread_yield_has_null_arg" = "yes"; then
+ AC_DEFINE(PTHREAD_YIELD_HAS_NULL_ARG, 1, [Define if
pthread_yield has a NULL arg])
+ fi
fi
fi
fi
Index: threadproc/unix/thread.c
===================================================================
--- threadproc/unix/thread.c (revision 594914)
+++ threadproc/unix/thread.c (working copy)
@@ -251,7 +251,11 @@
APR_DECLARE(void) apr_thread_yield(void)
{
#ifdef HAVE_PTHREAD_YIELD
+#ifdef PTHREAD_YIELD_HAS_NULL_ARG
+ pthread_yield(NULL);
+#else
pthread_yield();
+#endif /* PTHREAD_YIELD_HAS_NULL_ARG */
#else
#ifdef HAVE_SCHED_YIELD
sched_yield();
pthread.arg.patch
Description: Binary data
