Logo Search packages:      
Sourcecode: poco version File versions  Download package

template<class Mtx>
bool Poco::Condition::tryWait ( Mtx &  mutex,
long  milliseconds 
) [inline]

Unlocks the mutex (which must be locked upon calling tryWait()) and waits for the given time until the Condition is signalled.

The given mutex will be locked again upon leaving the function, even in case of an exception.

Returns true if the Condition has been signalled within the given time interval, otherwise false.

Definition at line 106 of file Condition.h.

References Poco::Event::tryWait().

            ScopedUnlock<Mtx> unlock(mutex, false);
            Event event;
                  FastMutex::ScopedLock lock(_mutex);
            if (!event.tryWait(milliseconds))
                  FastMutex::ScopedLock lock(_mutex);
                  return false;
            return true;

Generated by  Doxygen 1.6.0   Back to index