Rainer Orth <[email protected]> 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
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. */