From: Russ Cox Date: Tue, 25 Oct 2016 00:47:31 +0000 (-0400) Subject: runtime: accept timeout from non-timeout semaphore wait on OS X X-Git-Tag: go1.8beta1~657 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=71cf409dbdcba20f220d65ab83a6494c1f79b2a0;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor Reviewed-by: Brad Fitzpatrick --- diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go index fa5aca2f99..0dfe8778db 100644 --- a/src/runtime/os_darwin.go +++ b/src/runtime/os_darwin.go @@ -414,7 +414,10 @@ func semasleep1(ns int64) int32 { if r == 0 { break } - if r == _KERN_ABORTED { // interrupted + // Note: We don't know how this call (with no timeout) can get _KERN_OPERATION_TIMED_OUT, + // but it does reliably, though at a very low rate, on OS X 10.8, 10.9, 10.10, and 10.11. + // See golang.org/issue/17161. + if r == _KERN_ABORTED || r == _KERN_OPERATION_TIMED_OUT { // interrupted continue } macherror(r, "semaphore_wait")