[Haskell-cafe] STM and `orElse` on a few thousand TMVars

Maarten Hazewinkel maarten.hazewinkel at gmail.com
Tue Dec 6 09:43:44 EST 2005

On 12/6/05, Joel Reymont <joelr1 at gmail.com> wrote:
> I'm trying to implement a better waitForChildren from the docs for
> Control.Concurrent.
> I would like to know when all the children exit, basically, and I
> thought it would be neat to try to do that with STM.

I apologise if this doesn't make sense (I'm fairly new to Haskell), but
wouldn't a single shared counter be sufficient for this?

Increment for each child launched.
Decrement by each finished child.
When it's back down to zero, you're done.



More information about the Haskell-Cafe mailing list