From a352470914661b79a04946a585e1859addbbe208 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 26 Oct 2014 09:20:18 -0600 Subject: [PATCH] work around a kqueue bug(?) on Mac OS X There seems to be a problem in kqueue() on Mac OS X for watching for FIFO write availability, where adding a read event for the same FIFO (at a different file descritor) can disable the write event. Merge to v6.1.1 --- racket/src/racket/src/thread.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/racket/src/racket/src/thread.c b/racket/src/racket/src/thread.c index 0b35ef70d9..8dad29dc56 100644 --- a/racket/src/racket/src/thread.c +++ b/racket/src/racket/src/thread.c @@ -3739,8 +3739,12 @@ Scheme_Object *scheme_fd_to_semaphore(intptr_t fd, int mode, int is_socket) # ifdef HAVE_KQUEUE_SYSCALL if (!is_socket) { - if (!scheme_fd_regular_file(fd, 2)) - return NULL; /* kqueue() might not work on devices, such as ttys */ + /* kqueue() might not work on devices, such as ttys; also, while + Mac OS X kqueue() claims to work on FIFOs, there are problems: + watching for reads on a FIFO sometimes disables watching for + writes on the same FIFO with a different file descriptor */ + if (!scheme_fd_regular_file(fd, 1)) + return NULL; } if (scheme_semaphore_fd_kqueue < 0) { scheme_semaphore_fd_kqueue = kqueue();