From: Ian Lance Taylor Date: Thu, 10 Jun 2021 22:35:05 +0000 (-0700) Subject: runtime: loop on EINTR in macOS sigNoteSleep X-Git-Tag: go1.17rc1~119 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=77aa209b386a184e7f4b44938f2a05a1b5c5a3cf;p=gostls13.git runtime: loop on EINTR in macOS sigNoteSleep Fixes #46466 Change-Id: I8fb15d0c8ef7ef6e6fc1b9e0e033d213255fe0df Reviewed-on: https://go-review.googlesource.com/c/go/+/326778 Trust: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Go Bot Reviewed-by: Michael Knyszek Reviewed-by: Cherry Mui --- diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go index 00139351ab..079be107d7 100644 --- a/src/runtime/os_darwin.go +++ b/src/runtime/os_darwin.go @@ -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.