[Haskell] Wait for *either* MVar to be set
bf3 at telenet.be
Wed Nov 26 13:04:57 EST 2008
Maybe this is not the correct mailing list to ask this question, but as a similar question was asked seemingly unanswered by Duncan Coutts in 2002 (http://markmail.org/message/kftpnulks7mbz2ij), and as this most likely has to do with the GHC runtime, I might have more luck to get an answer here... Sorry for the spam if this is inappropriate; please say so and I will resubscribe to the Haskell Cafe mailing list, not polluting this main list anymore...
So here's my question.
GHC provides MVar for nice lightweight concurrency synchronization.
However, preemptive multitasking operating systems offer support for waiting for multiple "MVars", until *either* one of them returns (or timeouts).
I see no way of achieving this with GHC's MVar, unless using Conal Elliott's unamb package on Hackage that emulates this by spawning and killing two threads (which might be an expensive operation, I'm not sure)
Am I wrong in this? If so, is this something that might be considered as a future enhancement in the GHC libraries and runtime?
Thanks very much,
CTO - Anygma
More information about the Haskell