[Haskell-cafe] Implementing computations with timeout

Simon Marlow simonmar at microsoft.com
Mon Jan 10 12:02:40 EST 2005


On 07 January 2005 20:00, Sebastian Sylvan wrote:

> On Fri, 7 Jan 2005 20:56:42 +0100, Sebastian Sylvan
> <sebastian.sylvan at gmail.com> wrote:
>> On Fri, 07 Jan 2005 15:31:10 +0200, Einar Karttunen
>> <ekarttun at cs.helsinki.fi> wrote:
>>> Hello
>>> 
>>> What is the best way of doing an computation with a timeout?
>> 
>> I like the approach taken in  "Tackling the ackward squad":
>> 
> 
> I should also state that this isn't safe when it comes to asynchronous
> exceptions.
> If one were to raise an exception in a timeout'd computation it would
> simply abort the takeMVar which means the two child processes won't
> get killed.

Yes, making a timeout combinator that (a) can be nested and (b) is
invisible with respect to asynchronous exceptions is quite a challenge.
I'm not sure that we managed to do it.  STM will almost certainly make
it easier, though.

Cheers,
	Simon


More information about the Haskell-Cafe mailing list