Skip to content

Commit

Permalink
runtime: loop on EINTR in macOS sigNoteSleep
Browse files Browse the repository at this point in the history
Fixes #46466

Change-Id: I8fb15d0c8ef7ef6e6fc1b9e0e033d213255fe0df
Reviewed-on: https://go-review.googlesource.com/c/go/+/326778
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
  • Loading branch information
ianlancetaylor committed Jun 11, 2021
1 parent e2dc6dd commit 77aa209
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/runtime/os_darwin.go
Expand Up @@ -118,10 +118,15 @@ func sigNoteWakeup(*note) {

// sigNoteSleep waits for a note created by sigNoteSetup to be woken.
func sigNoteSleep(*note) {
entersyscallblock()
var b byte
read(sigNoteRead, unsafe.Pointer(&b), 1)
exitsyscall()
for {
var b byte
entersyscallblock()
n := read(sigNoteRead, unsafe.Pointer(&b), 1)
exitsyscall()
if n != -_EINTR {
return
}
}
}

// BSD interface for threading.
Expand Down

0 comments on commit 77aa209

Please sign in to comment.