Mercurial > hg > CbC > CbC_gcc
view libgo/misc/cgo/test/issue3775.go @ 133:420680fc7707
do normal call in goto codesegment in normal function
author | anatofuz |
---|---|
date | Sat, 03 Nov 2018 19:49:09 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// +build !android package cgotest /* void lockOSThreadCallback(void); inline static void lockOSThreadC(void) { lockOSThreadCallback(); } int usleep(unsigned usec); */ import "C" import ( "runtime" "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() } //export lockOSThreadCallback func lockOSThreadCallback() { runtime.LockOSThread() runtime.UnlockOSThread() go C.usleep(10000) runtime.Gosched() }