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 5package main 6 7import "C" 8 9import ( 10 "os" 11 "runtime" 12 "sync/atomic" 13) 14 15var started int32 16 17// Start a goroutine that loops forever. 18func init() { 19 runtime.GOMAXPROCS(1) 20 go func() { 21 for { 22 atomic.StoreInt32(&started, 1) 23 } 24 }() 25} 26 27//export GoFunction8 28func GoFunction8() { 29 for atomic.LoadInt32(&started) == 0 { 30 runtime.Gosched() 31 } 32 os.Exit(0) 33} 34 35func main() { 36} 37