interruptible file open
Motivation
When working with FIFOs, it's sometimes desirable to using a blocking open, so that it will wait until a writer appears. base offers this in GHC.IO.Handle.FD.openFileBlocking
. However, that call is not interruptible. I've made a very simple single-threaded program which is intended to blocking-open a FIFO repeatedly as its main loop, and which should shut down on ctrl+c, but in order to get this I had to hack up my own special open and read calls where the open call is marked interruptible
.
Proposal
Unless it's a bad idea, set the c_safe_open
foreign call to interruptible
and make it deal properly with asynchronous exceptions. Otherwise, offer a new way to get an interruptible blocking open.