mirror of
https://github.com/golang/go
synced 2024-11-17 16:34:43 -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()
|
||
|
}
|