]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/race: do not include pthread.h
authorDmitriy Vyukov <dvyukov@google.com>
Tue, 5 Feb 2013 09:08:07 +0000 (13:08 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Tue, 5 Feb 2013 09:08:07 +0000 (13:08 +0400)
Fixes #4721.

R=alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/7275048

src/pkg/runtime/race/testdata/cgo_test_main.go

index 789ea0adc38921464c915925a617d30c3cc0bc7e..620cea18bc078b1ec1b3a20bf6dfceebc3084ee2 100644 (file)
@@ -5,26 +5,16 @@
 package main
 
 /*
-#include <pthread.h>
-
-pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
 int sync;
 
 void Notify(void)
 {
-       pthread_mutex_lock(&mtx);
-       sync = 1;
-       pthread_cond_broadcast(&cv);
-       pthread_mutex_unlock(&mtx);
+       __sync_fetch_and_add(&sync, 1);
 }
 
 void Wait(void)
 {
-       pthread_mutex_lock(&mtx);
-       while(sync == 0)
-               pthread_cond_wait(&cv, &mtx);
-       pthread_mutex_unlock(&mtx);
+       while(__sync_fetch_and_add(&sync, 0) == 0) {}
 }
 */
 import "C"