From: Joshua Napoli (jnapoli_at_[hidden])
Date: 2003-05-08 15:16:39


Is there any way to wait for one of several condition objects to become
ready? Is there some reason that this capability is omitted from the thread
library?

I would like to do something like this:

mutex monitorA, monitorB;
condition conditionA, conditionB;
double_condition conditionAB(conditionA,conditionB);

void
executeNextEvent()
{
    lock lkA(monitorA);
    lock lkB(monitorB);

        //Wait for either conditionA or conditionB to become ready.
    conditionAB.wait(lkA,predicateA,lkB,predicateB);

    if(predicateA()) {
      executeEventA();
        } else {
            executeEventB();
        }
}

[Non-text portions of this message have been removed]