From 568d94164d0cf7bb6edaa27554e6e3a0f003434e Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Wed, 7 Dec 2011 11:26:45 +0200 Subject: [PATCH] runtime: handle KERN_ABORTED in the darwin semaphore implementation Analogous to EINTR. --- src/runtime/darwin-os.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/runtime/darwin-os.c b/src/runtime/darwin-os.c index df53e98..568bbc7 100644 --- a/src/runtime/darwin-os.c +++ b/src/runtime/darwin-os.c @@ -193,11 +193,19 @@ os_sem_wait(os_sem_t *sem, char *what) switch (ret) { case KERN_SUCCESS: return; + /* It is unclear just when we can get this, but a sufficiently + * long wait seems to do that, at least sometimes. + * + * However, a wait that long is definitely abnormal for the + * GC, so we complain before retrying. + */ case KERN_OPERATION_TIMED_OUT: fprintf(stderr, "%s: os_sem_wait(%p): %s", what, sem, strerror(errno)); + /* This is analogous to POSIX EINTR. */ + case KERN_ABORTED: goto restart; default: - lose("%s: os_sem_wait(%p): %s", what, sem, strerror(errno)); + lose("%s: os_sem_wait(%p): %lu, %s", what, sem, ret, strerror(errno)); } } -- 1.7.10.4