go/src/cmd/cgo/internal
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
..
swig misc/swig: move tests to cmd/cgo/internal 2023-05-12 12:00:07 +00:00
test cmd/cgo/internal/test: fix TestThreadLock 2023-05-18 16:55:07 +00:00
testcarchive runtime/cgo: store M for C-created thread in pthread key 2023-05-17 21:53:11 +00:00
testcshared
testerrors cmd/dist: drop host test support 2023-05-12 12:35:03 +00:00
testfortran cmd/dist: drop host test support 2023-05-12 12:35:03 +00:00
testgodefs cmd/dist: drop host test support 2023-05-12 12:35:03 +00:00
testlife cmd/dist: drop host test support 2023-05-12 12:35:03 +00:00
testnocgo
testplugin
testsanitizers runtime/cgo: store M for C-created thread in pthread key 2023-05-17 21:53:11 +00:00
testshared
testso
testsovar
teststdio cmd/dist: drop host test support 2023-05-12 12:35:03 +00:00
testtls