go/src/cmd/cgo/internal/test
Austin Clements 88f89d87c4 cmd/cgo/internal/test: fix TestThreadLock
This test was introduced in CL 18882, but only recently enabled as of
CL 493603. It's intended to check that we don't move executing C code
between threads when it re-enters Go, but it has always contained a
flake. Go *can* preempt between the Go call to gettid and the C call
to gettid and move the goroutine to another thread because there's no
C code on the stack during the Go call to gettid. This will cause the
test to fail.

Fix this by making both gettid calls in C, with a re-entry to Go
between them.

Fixes #60265

Change-Id: I546621a541ce52b996d68b17d3bed709d2b5b1f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/496182
Auto-Submit: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
2023-05-18 16:55:07 +00:00
..
gcc68255
issue8756
issue8828
issue9026
issue9400
issue9510a
issue9510b
issue20266
issue23555a
issue23555b
issue24161arg
issue24161e0
issue24161e1
issue24161e2
issue24161res
issue26213
issue26430
issue26743
issue27054
issue27340
issue29563
issue30527
issue41761a
issue43639
issue52611a
issue52611b
backdoor.go
buildid_linux.go
callback.go
callback_c.c
callback_c_gc.c
callback_c_gccgo.c
cgo_linux_test.go
cgo_stubs_android_test.go
cgo_test.go runtime/cgo: store M for C-created thread in pthread key 2023-05-17 21:53:11 +00:00
cgo_thread_lock.go cmd/cgo/internal/test: fix TestThreadLock 2023-05-18 16:55:07 +00:00
cgo_unix_test.go
cthread_unix.c runtime/cgo: store M for C-created thread in pthread key 2023-05-17 21:53:11 +00:00
cthread_windows.c runtime/cgo: store M for C-created thread in pthread key 2023-05-17 21:53:11 +00:00
gcc68255.go
issue1435.go
issue4029.c
issue4029.go
issue4029w.go
issue4273.c
issue4273b.c
issue4339.c
issue4339.h
issue5548_c.c
issue5740a.c
issue5740b.c
issue6833_c.c
issue6907export_c.c
issue6997_linux.c
issue6997_linux.go
issue7234_test.go
issue8148.c
issue8148.go
issue8331.h
issue8517.go
issue8517_windows.c
issue8517_windows.go
issue8694.go
issue8756.go
issue8811.c
issue8828.go
issue9026.go
issue9400_linux.go
issue9510.go
issue18146.go
issue20266.go
issue20910.c
issue21897.go
issue21897b.go
issue23555.go
issue24161_darwin_test.go
issue26430.go
issue26743.go
issue27340.go
issue29563.go
issue30527.go
issue31891.c
issue41761.go
issue42018.go
issue42018_windows.go
issue42495.go
issue43639.go
issue52611.go
setgid2_linux.go
setgid_linux.go
sigaltstack.go
sigprocmask.c
sigprocmask.go
test.go
test26213.go
test_unix.go
test_windows.go
testx.c
testx.go runtime/cgo: store M for C-created thread in pthread key 2023-05-17 21:53:11 +00:00
typeparam.go