mirror of
https://github.com/golang/go
synced 2024-11-20 10:24:40 -07:00
30 lines
462 B
Go
30 lines
462 B
Go
|
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()
|
||
|
}
|