It looks like kqueue() is broken for FIFOs on Mac OS X. See the enclosed "kqueue_fifo.c". Unless I'm confused (a review of the enclosed program would be welcome), adding a kqueue event to watch for FIFO input disables an event that watches for FIFO output space, or something like that.
I enabled the use of kqueue() on FIFOs only in June. I'll disable it again. At Sat, 25 Oct 2014 21:06:54 -0700, Eric Dobson wrote: > I'm attempting to use FIFOs as a simple IPC mechanism and I'm getting > into a deadlock. I've simplified my program to the following and am > still getting deadlocks. I believe that this shouldn't have an issues, > but I might be wrong about that. Am I doing something wrong, or might > this be a bug in the IO system? I'm running on OS X 10.9.5 if that is > relevant. > > It usually gets stuck at around 10-11 thousand. > > > #lang racket > > (define the-fifo-path "the-fifo") > > (when (file-exists? the-fifo-path) > (delete-file the-fifo-path)) > > (system "mkfifo the-fifo") > > (thread > (lambda () > (call-with-output-file* the-fifo-path #:exists 'append > (lambda (port) > (file-stream-buffer-mode port 'none) > (let loop ([i 0]) > (printf "Writing ~a~n" i) > (write i port) > (newline port) > (loop (add1 i))))))) > > (call-with-input-file* the-fifo-path > (lambda (port) > (file-stream-buffer-mode port 'none) > (let loop () > (displayln "Reading") > (define v (read-line port)) > (unless (eof-object? v) > (printf "Read ~a~n" v) > (loop))))) > ____________________ > Racket Users list: > http://lists.racket-lang.org/users
kqueue_fifo.c
Description: Binary data
____________________ Racket Users list: http://lists.racket-lang.org/users