1
0
mirror of https://github.com/golang/go synced 2024-11-17 16:34:43 -07:00
go/misc/cgo/test/issue3775.go

30 lines
462 B
Go
Raw Normal View History

package cgotest
/*
void lockOSThreadCallback(void);
inline static void lockOSThreadC(void)
{
lockOSThreadCallback();
}
int usleep(unsigned usec);
*/
import "C"
import (
"runtime"
"testing"
)
func test3775(t *testing.T) {
// Used to panic because of the UnlockOSThread below.
C.lockOSThreadC()
}
//export lockOSThreadCallback
func lockOSThreadCallback() {
runtime.LockOSThread()
runtime.UnlockOSThread()
go C.usleep(10000)
runtime.Gosched()
}