示例#1
0
文件: tsan.go 项目: sreis/go
func main() {
	runtime.LockOSThread()
	C.setVal(1)
	c := make(chan bool)
	go func() {
		runtime.LockOSThread()
		C.setVal(2)
		c <- true
	}()
	<-c
	if v := C.getVal(); v != 2 {
		panic(v)
	}
}
示例#2
0
文件: tsan2.go 项目: Greentor/go
//export GoRun
func GoRun() {
	runtime.LockOSThread()
	c := make(chan bool)
	go func() {
		runtime.LockOSThread()
		C.setVal(2)
		c <- true
	}()
	<-c
}