github.com/mdempsky/go@v0.0.0-20151201204031-5dd372bd1e70/misc/cgo/test/issue9400/gccgo.go (about)

     1  // Copyright 2014 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  // +build gccgo
     6  
     7  package issue9400
     8  
     9  import (
    10  	"runtime"
    11  	"sync/atomic"
    12  )
    13  
    14  // The test for the gc compiler resets the stack pointer so that the
    15  // stack gets modified.  We don't have a way to do that for gccgo
    16  // without writing more assembly code, which we haven't bothered to
    17  // do.  So this is not much of a test.
    18  
    19  func RewindAndSetgid() {
    20  	atomic.StoreInt32(&Baton, 1)
    21  	for atomic.LoadInt32(&Baton) != 0 {
    22  		runtime.Gosched()
    23  	}
    24  }