Example #1
0
File: tsan.go Project: 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)
	}
}
Example #2
0
File: tsan2.go Project: Greentor/go
//export GoRun
func GoRun() {
	runtime.LockOSThread()
	c := make(chan bool)
	go func() {
		runtime.LockOSThread()
		C.setVal(2)
		c <- true
	}()
	<-c
}