[Haskell-cafe] STM, orElse and timed read from a channel

Joel Reymont joelr1 at gmail.com
Mon Nov 28 18:27:46 EST 2005


How would you implement a timed read from a channel with STM? I would  
like to return Timeout if nothing was read from a TChan in X ms.

Is this a basic two-thread timeout implementation or is there a more  
elegant way of implementing this using `orElse`?

	Thanks, Joel


More information about the Haskell-Cafe mailing list