Skip to content

Commit 3c0fbee

Browse files
runtime: disable preemption during test calls to futexsleep
Fixes #35347 Change-Id: If7380f29e97a5abe86cdd5e2853323de7997ccfc Reviewed-on: https://go-review.googlesource.com/c/go/+/205378 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
1 parent d51f7f3 commit 3c0fbee

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/runtime/export_futex_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,14 @@
66

77
package runtime
88

9-
var Futexsleep = futexsleep
109
var Futexwakeup = futexwakeup
10+
11+
//go:nosplit
12+
func Futexsleep(addr *uint32, val uint32, ns int64) {
13+
// Temporarily disable preemption so that a preemption signal
14+
// doesn't interrupt the system call.
15+
poff := debug.asyncpreemptoff
16+
debug.asyncpreemptoff = 1
17+
futexsleep(addr, val, ns)
18+
debug.asyncpreemptoff = poff
19+
}

0 commit comments

Comments
 (0)