[Haskell-cafe] timeout and waitForProcess

Bryan O'Sullivan bos at serpentine.com
Tue Nov 20 19:46:30 EST 2007


Tim Bauer wrote:
> Does anyone know if the new System.Timeout.timeout combinator can wakeup from
> System.Process.waitForProcess?

No, this is expected behaviour per the documentation:

"The technique works very well for computations executing inside of the 
Haskell runtime system, but it doesn't work at all for non-Haskell code. 
Foreign function calls, for example, cannot be timed out with this 
combinator simply because an arbitrary C function cannot receive 
asynchronous exceptions."

In principle, this FFI restriction could be partly lifted on POSIX 
systems, at least for some library calls, by use of thread cancellation. 
  However, the thread cancellation rules are sufficiently subtle that I 
have never heard of anyone actually using this facility.  I wouldn't 
want to be trying to write or maintain this code, though.

	<b


More information about the Haskell-Cafe mailing list