Commit 6b1b613d authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime/race: do not include pthread.h

Fixes #4721.

R=alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/7275048
parent e7fe1944
...@@ -5,26 +5,16 @@ ...@@ -5,26 +5,16 @@
package main package main
/* /*
#include <pthread.h>
pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
int sync; int sync;
void Notify(void) void Notify(void)
{ {
pthread_mutex_lock(&mtx); __sync_fetch_and_add(&sync, 1);
sync = 1;
pthread_cond_broadcast(&cv);
pthread_mutex_unlock(&mtx);
} }
void Wait(void) void Wait(void)
{ {
pthread_mutex_lock(&mtx); while(__sync_fetch_and_add(&sync, 0) == 0) {}
while(sync == 0)
pthread_cond_wait(&cv, &mtx);
pthread_mutex_unlock(&mtx);
} }
*/ */
import "C" import "C"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment