apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roo...@apache.org
Subject svn commit: r418351 - in /apr/apr/trunk: CHANGES configure.in include/arch/unix/apr_arch_threadproc.h threadproc/unix/thread.c
Date Fri, 30 Jun 2006 18:14:22 GMT
Author: rooneg
Date: Fri Jun 30 11:14:21 2006
New Revision: 418351

URL: http://svn.apache.org/viewvc?rev=418351&view=rev
Log:
Implement apr_thread_yield on Unix in terms of pthread_yield or sched_yield.

Submitted by: Keisuke Nishida <keisuke.nishida gmail.com>
Reviewed by: rooneg, Henry Jen <henryjen ztune.net>

* configure.in: Look for pthread_yield and sched_yield.

* include/arch/unix/apr_arch_threadproc.h: Include sched.h if it's present.

* threadproc/unix/thread.c
  (apr_thread_yield): Actually do something in here...

* CHANGES: Note change.

Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/configure.in
    apr/apr/trunk/include/arch/unix/apr_arch_threadproc.h
    apr/apr/trunk/threadproc/unix/thread.c

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=418351&r1=418350&r2=418351&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES (original)
+++ apr/apr/trunk/CHANGES Fri Jun 30 11:14:21 2006
@@ -1,5 +1,8 @@
 Changes for APR 1.3.0
 
+  *) Implement apr_thread_yield on Unix in terms of pthread_yield or
+     sched_yield. [Keisuke Nishida <keisuke.nishida gmail.com>]
+
   *) Provide folding in autogenerated .manifest files for Win32 builders
      using VisualStudio 2005  [William Rowe]
 

Modified: apr/apr/trunk/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/configure.in?rev=418351&r1=418350&r2=418351&view=diff
==============================================================================
--- apr/apr/trunk/configure.in (original)
+++ apr/apr/trunk/configure.in Fri Jun 30 11:14:21 2006
@@ -580,7 +580,7 @@
         APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG
         APR_CHECK_PTHREAD_RECURSIVE_MUTEX
         AC_CHECK_FUNCS([pthread_key_delete pthread_rwlock_init \
-                        pthread_attr_setguardsize])
+                        pthread_attr_setguardsize pthread_yield])
 
         if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
             dnl ----------------------------- Checking for pthread_rwlock_t
@@ -592,6 +592,12 @@
             if test "$apr_cv_type_rwlock_t" = "yes"; then
                AC_DEFINE(HAVE_PTHREAD_RWLOCKS, 1, [Define if pthread rwlocks are available])
             fi
+        fi
+
+        if test "$ac_cv_func_pthread_yield" = "no"; then
+            dnl ----------------------------- Checking for sched_yield
+            AC_CHECK_HEADERS([sched.h])
+            AC_CHECK_FUNCS([sched_yield])
         fi
     fi
 fi

Modified: apr/apr/trunk/include/arch/unix/apr_arch_threadproc.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/unix/apr_arch_threadproc.h?rev=418351&r1=418350&r2=418351&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/unix/apr_arch_threadproc.h (original)
+++ apr/apr/trunk/include/arch/unix/apr_arch_threadproc.h Fri Jun 30 11:14:21 2006
@@ -39,6 +39,9 @@
 #if APR_HAVE_STRING_H
 #include <string.h>
 #endif
+#if HAVE_SCHED_H
+#include <sched.h>
+#endif
 /* End System Headers */
 
 

Modified: apr/apr/trunk/threadproc/unix/thread.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/unix/thread.c?rev=418351&r1=418350&r2=418351&view=diff
==============================================================================
--- apr/apr/trunk/threadproc/unix/thread.c (original)
+++ apr/apr/trunk/threadproc/unix/thread.c Fri Jun 30 11:14:21 2006
@@ -245,8 +245,15 @@
     }
 }
 
-void apr_thread_yield()
+APR_DECLARE(void) apr_thread_yield(void)
 {
+#ifdef HAVE_PTHREAD_YIELD
+    pthread_yield();
+#else
+#ifdef HAVE_SCHED_YIELD
+    sched_yield();
+#endif
+#endif
 }
 
 APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,



Mime
View raw message