summaryrefslogtreecommitdiffhomepage
path: root/pkg/sync
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-11-23 22:33:38 +0000
committergVisor bot <gvisor-bot@google.com>2020-11-23 22:33:38 +0000
commitacb271686d5b01320f18da9e7c2f7b593eba8808 (patch)
treeb56e99343dadc24616bf9a0a9d5a45a9bc994823 /pkg/sync
parentc63d008af7b179833826c3e9dd5735e4ea5b10bc (diff)
parent3deb5d0c043dcfd8523425792c6cf8ec13b19868 (diff)
Merge release-20201109.0-102-g3deb5d0c0 (automated)
Diffstat (limited to 'pkg/sync')
-rw-r--r--pkg/sync/spin_legacy_unsafe.go25
-rw-r--r--pkg/sync/spin_unsafe.go2
2 files changed, 26 insertions, 1 deletions
diff --git a/pkg/sync/spin_legacy_unsafe.go b/pkg/sync/spin_legacy_unsafe.go
new file mode 100644
index 000000000..61fc7320e
--- /dev/null
+++ b/pkg/sync/spin_legacy_unsafe.go
@@ -0,0 +1,25 @@
+// Copyright 2020 The gVisor Authors.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build go1.13
+// +build !go1.14
+
+package sync
+
+import (
+ "runtime"
+ _ "unsafe" // for go:linkname
+)
+
+//go:linkname canSpin sync.runtime_canSpin
+func canSpin(i int) bool
+
+//go:linkname doSpin sync.runtime_doSpin
+func doSpin()
+
+func goyield() {
+ // goyield is not available until Go 1.14.
+ runtime.Gosched()
+}
diff --git a/pkg/sync/spin_unsafe.go b/pkg/sync/spin_unsafe.go
index cafb2d065..18e8fc743 100644
--- a/pkg/sync/spin_unsafe.go
+++ b/pkg/sync/spin_unsafe.go
@@ -3,7 +3,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build go1.13
+// +build go1.14
// +build !go1.17
// Check go:linkname function signatures when updating Go version.