mirror of https://github.com/golang/go.git
runtime/race: do not include pthread.h
Fixes #4721. R=alex.brainman, minux.ma CC=golang-dev https://golang.org/cl/7275048
This commit is contained in:
parent
e7fe1944ac
commit
6b1b613d6a
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue