[Haskell-cafe] Re: [Haskell] Wait for *either* MVar to be set

Isaac Dupree isaacdupree at charter.net
Wed Nov 26 14:41:15 EST 2008


Peter Verswyvelen wrote:
> ... by spawning and killing two threads (which might be an expensive operation, I'm not sure)

pretty cheap in GHC -- they're not system threads

> Am I wrong in this? If so, is this something that might be considered as a future enhancement in the GHC libraries and runtime?

Also, look at STM (e.g. TVars), which is designed to do what 
you want more directly, I think.

(timeouts might still use the GHC-thread thing.  Don't worry 
about its performance unless you're measurably suffering 
from it...)

-Isaac


More information about the Haskell-Cafe mailing list