...

Source file src/cmd/cgo/internal/test/issue9400/gccgo.go

Documentation: cmd/cgo/internal/test/issue9400

     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  //go: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  var Baton int32
    20  
    21  func RewindAndSetgid() {
    22  	atomic.StoreInt32(&Baton, 1)
    23  	for atomic.LoadInt32(&Baton) != 0 {
    24  		runtime.Gosched()
    25  	}
    26  }
    27  

View as plain text