For some concurrent code, I want to connect a bunch of signals together like a circuit. In .NET we can do a WaitAll or WaitAny on a collection of signals. I want to do something like this:
WaitAny ( WaitAll (c1, c2), WaitAll (c3, c4) ) ;
Unfortunately, the library doesn't support composing these operations into more complex trees. My questions are (1) Is there a way to do this in .NET? (2) Is there a slick library for this in any language?
[edit: Cory asked for more details]
I want to build a message passing library. There could be 10K small concurrent queues, some with messages. I want to grab a message from a queue and execute a handler assigned to the queue. However, I can't grab the next message until the handler is done (single threaded per queue). So really I want to wait on both the queue (got a message?) and the code (finished with previous message?) before popping and executing the next item.