logo       

Re: Implementing computations with timeout: msg#00098

lang.haskell.cafe

Subject: Re: Implementing computations with timeout

Einar Karttunen writes:

> What is the best way of doing an computation with a timeout?

At <http://cryp.to/child/> you'll find a very readable and
straightforward implementation of a generic timeout
function:

type Timeout = Int
timeout :: Timeout -> IO a -> IO (Maybe a)

The function uses the "two threads" approach you've
outlined, and it has proven to work nicely in practice.

Peter


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise