Patchwork Go patch committed: Update Go library

login
register
mail settings
Submitter Ian Taylor
Date Oct. 31, 2011, 10:09 p.m.
Message ID <mcrvcr4u82z.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/122981/
State New
Headers show

Comments

Ian Taylor - Oct. 31, 2011, 10:09 p.m.
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> the only issue I've found on Solaris is the use of pthread_yield, which
> doesn't exist even on Solaris 11.  The following patch checks for this,
> and falls back to thr_yield if available.

Rather than that patch, I changed the code to use sched_yield rather
than pthread_yield.  I realized that libgo is already using sched_yield,
in runtime/go-sched.c.  There shouldn't be any portability penalty to
also using it in yield.c.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

Patch

diff -r 7135ea46b116 libgo/runtime/yield.c
--- a/libgo/runtime/yield.c	Mon Oct 31 14:53:56 2011 -0700
+++ b/libgo/runtime/yield.c	Mon Oct 31 14:58:19 2011 -0700
@@ -9,7 +9,7 @@ 
 #include <stddef.h>
 #include <sys/types.h>
 #include <sys/time.h>
-#include <pthread.h>
+#include <sched.h>
 #include <unistd.h>
 
 #ifdef HAVE_SYS_SELECT_H
@@ -38,7 +38,7 @@ 
 void
 runtime_osyield (void)
 {
-  pthread_yield ();
+  sched_yield ();
 }
 
 /* Sleep for some number of microseconds.  */