Skip to content

Commit

Permalink
runtime: accept timeout from non-timeout semaphore wait on OS X
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
rsc committed Oct 25, 2016
1 parent b4ce38e commit 71cf409
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/runtime/os_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 71cf409

Please sign in to comment.