From 6b1b613d6aa77da31348bfe76991e564c106bbba Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Tue, 5 Feb 2013 13:08:07 +0400 Subject: [PATCH] runtime/race: do not include pthread.h Fixes #4721. R=alex.brainman, minux.ma CC=golang-dev https://golang.org/cl/7275048 --- src/pkg/runtime/race/testdata/cgo_test_main.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/pkg/runtime/race/testdata/cgo_test_main.go b/src/pkg/runtime/race/testdata/cgo_test_main.go index 789ea0adc3..620cea18bc 100644 --- a/src/pkg/runtime/race/testdata/cgo_test_main.go +++ b/src/pkg/runtime/race/testdata/cgo_test_main.go @@ -5,26 +5,16 @@ package main /* -#include - -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" -- 2.48.1