diff libgo/misc/cgo/test/issue9400/gccgo.go @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/misc/cgo/test/issue9400/gccgo.go	Fri Oct 27 22:46:09 2017 +0900
@@ -0,0 +1,24 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build gccgo
+
+package issue9400
+
+import (
+	"runtime"
+	"sync/atomic"
+)
+
+// The test for the gc compiler resets the stack pointer so that the
+// stack gets modified.  We don't have a way to do that for gccgo
+// without writing more assembly code, which we haven't bothered to
+// do.  So this is not much of a test.
+
+func RewindAndSetgid() {
+	atomic.StoreInt32(&Baton, 1)
+	for atomic.LoadInt32(&Baton) != 0 {
+		runtime.Gosched()
+	}
+}