]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/test: test recursive internal OS thread lock
authorRuss Cox <rsc@golang.org>
Tue, 23 Jul 2013 18:43:55 +0000 (14:43 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 23 Jul 2013 18:43:55 +0000 (14:43 -0400)
This would have failed with CL 11663043.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11480045

misc/cgo/test/issue3775.go

index c05a5d4be8a5f496b54c52ca54571be13211007a..8f8185419532005249a17b678e0f5b56a6d3decf 100644 (file)
@@ -15,6 +15,14 @@ import (
        "testing"
 )
 
+func init() {
+       // Same as test3775 but run during init so that
+       // there are two levels of internal runtime lock
+       // (1 for init, 1 for cgo).
+       // This would have been broken by CL 11663043.
+       C.lockOSThreadC()
+}
+
 func test3775(t *testing.T) {
        // Used to panic because of the UnlockOSThread below.
        C.lockOSThreadC()