hWaitForInput and timeouts

Simon Marlow simonmar at microsoft.com
Tue Oct 5 08:53:30 EDT 2004


On 03 October 2004 19:34, Peter Simons wrote:

> I have another I/O problem. I need to time out when a Handle
> blocks forever. I am using hWaitForInput anyway, so that
> shouldn't be a problem, but the documentation says that
> using this feature will block all IO threads? Is it much
> work to fix this? I _could_ forkIO a racer thread myself, of
> course, but it feels wrong to do that around a function that
> has an explicit timeout argument. :-)

I've fixed it so it'll work in the threaded RTS.  However, forking a
Haskell thread to do the threadDelay might still be quicker.

In the unthreaded RTS there isn't an easy fix, I'm afraid.  The reason
is that we don't currently have a way to block a thread on both I/O
*and* a timeout.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list