From: Michael Pratt Date: Mon, 17 Apr 2023 18:12:25 +0000 (-0400) Subject: Revert "runtime: correct GoCheckBindM's C declaration in EnsureBindM test" X-Git-Tag: go1.21rc1~877 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=97e5ca6d4eed7b14a4dbdd52aa4e934028284993;p=gostls13.git Revert "runtime: correct GoCheckBindM's C declaration in EnsureBindM test" This reverts CL 482975. Reason for revert: CL 481061 causes C TSAN failures and must be reverted. See CL 485275. This CL depends on CL 481061. For #59678. Change-Id: I4599e93d536149bcec94a5a1542533107699514f Reviewed-on: https://go-review.googlesource.com/c/go/+/485317 Reviewed-by: Than McIntosh TryBot-Result: Gopher Robot Run-TryBot: Michael Pratt Auto-Submit: Michael Pratt --- diff --git a/src/runtime/testdata/testprogcgo/bindm.c b/src/runtime/testdata/testprogcgo/bindm.c deleted file mode 100644 index 815d8a75f2..0000000000 --- a/src/runtime/testdata/testprogcgo/bindm.c +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !plan9 && !windows - -#include -#include -#include -#include "_cgo_export.h" - -#define CTHREADS 2 -#define CHECKCALLS 100 - -static void* checkBindMThread(void* thread) { - int i; - for (i = 0; i < CHECKCALLS; i++) { - GoCheckBindM((uintptr_t)thread); - usleep(1); - } - return NULL; -} - -void CheckBindM() { - int i; - pthread_t s[CTHREADS]; - - for (i = 0; i < CTHREADS; i++) { - pthread_create(&s[i], NULL, checkBindMThread, &s[i]); - } - for (i = 0; i < CTHREADS; i++) { - pthread_join(s[i], NULL); - } -} diff --git a/src/runtime/testdata/testprogcgo/bindm.go b/src/runtime/testdata/testprogcgo/bindm.go index c2003c2093..ed2c6a7eea 100644 --- a/src/runtime/testdata/testprogcgo/bindm.go +++ b/src/runtime/testdata/testprogcgo/bindm.go @@ -10,7 +10,35 @@ package main /* -extern void CheckBindM(); +#include +#include +#include + +extern void GoCheckBindM(); + +#define CTHREADS 2 +#define CHECKCALLS 100 + +static void* checkBindMThread(void* thread) { + int i; + for (i = 0; i < CHECKCALLS; i++) { + GoCheckBindM((uintptr_t)thread); + usleep(1); + } + return NULL; +} + +static void CheckBindM() { + int i; + pthread_t s[CTHREADS]; + + for (i = 0; i < CTHREADS; i++) { + pthread_create(&s[i], NULL, checkBindMThread, &s[i]); + } + for (i = 0; i < CTHREADS; i++) { + pthread_join(s[i], NULL); + } +} */ import "C"