]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: loop on EINTR in macOS sigNoteSleep
authorIan Lance Taylor <iant@golang.org>
Thu, 10 Jun 2021 22:35:05 +0000 (15:35 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 11 Jun 2021 19:00:10 +0000 (19:00 +0000)
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>
src/runtime/os_darwin.go

index 00139351abc71091c27335749abb4ebab2671875..079be107d719a24891fdcef303b41bb115808ada 100644 (file)
@@ -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.