Exemplo n.º 1
0
// Returns -1 for a fatal error, 0 on success, and 1 if the time given in 
// milliseconds has expired before the condition variable has been signalled.
int
WinMonitorData::TimedWaitOnCondition( unsigned int cvid, int milliseconds )
{
    int ret = -1;

    assert( hMutex != NULL );

    ConditionVariableMap::iterator iter = cvmap.find( cvid );
    if( iter != cvmap.end() )
    {
        ConditionVariable* cv = cvmap[cvid];
        assert( cv != NULL );

        ret = cv->TimedWait(milliseconds);
    }
    else
    {
        // bad cvid
        // TODO how to indicate the error?
	    assert(0);
    }

    return ret;
}