aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/testdata
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@golang.org>2016-09-23 00:02:38 -0400
committerDavid Crawshaw <crawshaw@golang.org>2016-09-23 04:32:38 +0000
commited915ad421e61c3158ccae4bfbbcfbc796514ee2 (patch)
tree5ae68bc7e24c308a8d12238dabcb64d65e033aa2 /src/runtime/testdata
parentb444d438c061fa934130fed17d34c23e77174851 (diff)
downloadgo-ed915ad421e61c3158ccae4bfbbcfbc796514ee2.tar.xz
runtime: use sched_yield instead of pthread_yield
Attempt to fix the linux-amd64-clang builder, which broke with CL 29472. Turns out pthread_yield is a non-portable Linux function, and should have #define _GNU_SOURCE before #include <pthread.h>. GCC doesn't complain about this, but Clang does: ./raceprof.go:44:3: warning: implicit declaration of function 'pthread_yield' is invalid in C99 [-Wimplicit-function-declaration] (Though the error, while explicable, certainly could be clearer.) There is a portable POSIX equivalent, sched_yield, so this CL uses it instead. Change-Id: I58ca7a3f73a2b3697712fdb02e72a8027c391169 Reviewed-on: https://go-review.googlesource.com/29675 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/testdata')
-rw-r--r--src/runtime/testdata/testprogcgo/raceprof.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime/testdata/testprogcgo/raceprof.go b/src/runtime/testdata/testprogcgo/raceprof.go
index 8f50a8a425..fe624c541f 100644
--- a/src/runtime/testdata/testprogcgo/raceprof.go
+++ b/src/runtime/testdata/testprogcgo/raceprof.go
@@ -15,6 +15,7 @@ package main
#include <signal.h>
#include <stdint.h>
#include <pthread.h>
+#include <sched.h>
struct cgoTracebackArg {
uintptr_t context;
@@ -41,7 +42,7 @@ static void* raceprofThread(void* p) {
for (i = 0; i < 100; i++) {
pthread_kill(pthread_self(), SIGPROF);
- pthread_yield();
+ sched_yield();
}
return 0;
}