gccgo.go 611 B

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