introduce TDF_compare_debug, omit OBJ_TYPE_REF casts with it
[official-gcc.git] / libgo / misc / cgo / test / issue3775.go
blob5aca7602c03ff55e199b8d063e1b44c2f42b3851
1 // +build !android
3 package cgotest
5 /*
6 void lockOSThreadCallback(void);
7 inline static void lockOSThreadC(void)
9 lockOSThreadCallback();
11 int usleep(unsigned usec);
13 import "C"
15 import (
16 "runtime"
17 "testing"
20 func init() {
21 // Same as test3775 but run during init so that
22 // there are two levels of internal runtime lock
23 // (1 for init, 1 for cgo).
24 // This would have been broken by CL 11663043.
25 C.lockOSThreadC()
28 func test3775(t *testing.T) {
29 // Used to panic because of the UnlockOSThread below.
30 C.lockOSThreadC()
33 //export lockOSThreadCallback
34 func lockOSThreadCallback() {
35 runtime.LockOSThread()
36 runtime.UnlockOSThread()
37 go C.usleep(10000)
38 runtime.Gosched()