mirror of
https://github.com/golang/go
synced 2024-11-23 05:10:09 -07:00
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>
This commit is contained in:
parent
2068d5658e
commit
97e5ca6d4e
34
src/runtime/testdata/testprogcgo/bindm.c
vendored
34
src/runtime/testdata/testprogcgo/bindm.c
vendored
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
30
src/runtime/testdata/testprogcgo/bindm.go
vendored
30
src/runtime/testdata/testprogcgo/bindm.go
vendored
@ -10,7 +10,35 @@
|
|||||||
package main
|
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"
|
import "C"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user