@seealsomethodclose()
*//*-*****************************************************************************************************/ void open()
{ // We must safe access to our internal member!
std::unique_lock aLock( m_aAccessLock ); // Set condition -> wait don't block any longer -> gate is open
m_aPassage.set(); // Check if operation was successful! // Check returns false if condition isn't set => m_bClosed will be true then => we must return false; opening failed
m_bClosed = !m_aPassage.check();
}
@seealsomethodopen()
*//*-*****************************************************************************************************/ void close()
{ // We must safe access to our internal member!
std::unique_lock aLock( m_aAccessLock ); // Reset condition -> wait blocks now -> gate is closed
m_aPassage.reset(); // Check if operation was successful! // Check returns false if condition was reset => m_bClosed will be true then => we can return true; closing ok
m_bClosed = !m_aPassage.check();
}
*//*-*****************************************************************************************************/ void wait()
{ // We must safe access to our internal member!
std::unique_lock aLock( m_aAccessLock ); // If gate not closed - caller can pass it. if( m_bClosed )
{ // Then we must release used access lock - // because next call will block... // and if we hold the access lock nobody else can use this object without a deadlock!
aLock.unlock(); // Wait for opening gate...
m_aPassage.wait();
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.