Source file misc/cgo/testcarchive/testdata/libgo8/a.go
1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import "C" 8 9 import ( 10 "os" 11 "runtime" 12 "sync/atomic" 13 ) 14 15 var started int32 16 17 // Start a goroutine that loops forever. 18 func init() { 19 runtime.GOMAXPROCS(1) 20 go func() { 21 for { 22 atomic.StoreInt32(&started, 1) 23 } 24 }() 25 } 26 27 //export GoFunction8 28 func GoFunction8() { 29 for atomic.LoadInt32(&started) == 0 { 30 runtime.Gosched() 31 } 32 os.Exit(0) 33 } 34 35 func main() { 36 } 37