On Jun 23, 2012 6:43 PM, "Matthew R Chase" <ma...@chasefox.net> wrote:
>
> I'm not sure that timeoutReader works. I ran it, but it crashed with a nil memory address (or some-such) error when receiving data from the reader. Furthermore, the example instates one reader which continuously reads; the timeout does not affect the reader but just the blocking while listening for the reader. I found the concept to be misleading.
I'm not surprised it crashed - it was only half an hour's proof-of-concept (although I'd like to see the code that crashed for you, as I may end up using the code some time in the future).
Perhaps the name is misleading, but it is not possible to time out reads on a pipe AFAIK, so the only alternative is to leave the reader around indefinitely, and use the substitute "timeout reader" whenever you might wish to use the original.
You are trying to read no bytes. It will always return immediately.