Skip to content

Commit 71cf409

Browse files
committed
runtime: accept timeout from non-timeout semaphore wait on OS X
Looking at the kernel sources, I don't see how this is possible. But obviously it is. Just try again. Fixes #17161. Change-Id: Iea7d53f7cf75944792d2f75a0d07129831c7bcdb Reviewed-on: https://go-review.googlesource.com/31823 Run-TryBot: Russ Cox <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent b4ce38e commit 71cf409

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/runtime/os_darwin.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,10 @@ func semasleep1(ns int64) int32 {
414414
if r == 0 {
415415
break
416416
}
417-
if r == _KERN_ABORTED { // interrupted
417+
// Note: We don't know how this call (with no timeout) can get _KERN_OPERATION_TIMED_OUT,
418+
// but it does reliably, though at a very low rate, on OS X 10.8, 10.9, 10.10, and 10.11.
419+
// See golang.org/issue/17161.
420+
if r == _KERN_ABORTED || r == _KERN_OPERATION_TIMED_OUT { // interrupted
418421
continue
419422
}
420423
macherror(r, "semaphore_wait")

0 commit comments

Comments
 (0)