[Haskell-cafe] Re: Implementing computations with timeout

Peter Simons simons at cryp.to
Fri Jan 7 11:10:59 EST 2005

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

  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.


More information about the Haskell-Cafe mailing list