aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/testdata/testprogcgo
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2023-04-17 14:12:25 -0400
committerGopher Robot <gobot@golang.org>2023-04-17 18:46:31 +0000
commit97e5ca6d4eed7b14a4dbdd52aa4e934028284993 (patch)
tree55aab5eaec45804019e7cb995894b3201ae4e237 /src/runtime/testdata/testprogcgo
parent2068d5658e99f6cf13dd2648f3542d2c5bcdabfc (diff)
downloadgo-97e5ca6d4eed7b14a4dbdd52aa4e934028284993.tar.xz
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 <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/testdata/testprogcgo')
-rw-r--r--src/runtime/testdata/testprogcgo/bindm.c34
-rw-r--r--src/runtime/testdata/testprogcgo/bindm.go30
2 files changed, 29 insertions, 35 deletions
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 <stdint.h>
-#include <pthread.h>
-#include <unistd.h>
-#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 <stdint.h>
+#include <pthread.h>
+#include <unistd.h>
+
+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"