issue #4072 Carbon loop not ready within 5 sec
added lock to all condVar
This commit is contained in:
parent
9feaa959f1
commit
507abdcbfb
|
@ -106,9 +106,11 @@ void
|
||||||
CEventQueue::loop()
|
CEventQueue::loop()
|
||||||
{
|
{
|
||||||
m_buffer->init();
|
m_buffer->init();
|
||||||
*m_readyCondVar = true;
|
{
|
||||||
m_readyCondVar->signal();
|
CLock lock(m_readyMutex);
|
||||||
|
*m_readyCondVar = true;
|
||||||
|
m_readyCondVar->signal();
|
||||||
|
}
|
||||||
LOG((CLOG_DEBUG "event queue is ready"));
|
LOG((CLOG_DEBUG "event queue is ready"));
|
||||||
while (!m_pending.empty()) {
|
while (!m_pending.empty()) {
|
||||||
LOG((CLOG_DEBUG "add pending events to buffer"));
|
LOG((CLOG_DEBUG "add pending events to buffer"));
|
||||||
|
@ -556,16 +558,14 @@ CEventQueue::getSystemTarget()
|
||||||
void
|
void
|
||||||
CEventQueue::waitForReady() const
|
CEventQueue::waitForReady() const
|
||||||
{
|
{
|
||||||
double timeout = ARCH->time() + 5;
|
double timeout = ARCH->time() + 10;
|
||||||
m_readyCondVar->lock();
|
CLock lock(m_readyMutex);
|
||||||
|
|
||||||
while (!m_readyCondVar->wait()) {
|
while (!m_readyCondVar->wait()) {
|
||||||
if(ARCH->time() > timeout) {
|
if(ARCH->time() > timeout) {
|
||||||
throw std::runtime_error("event queue is not ready within 5 sec");
|
throw std::runtime_error("event queue is not ready within 5 sec");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_readyCondVar->unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1701,9 +1701,12 @@ COSXScreen::watchSystemPowerThread(void*)
|
||||||
m_events->waitForReady();
|
m_events->waitForReady();
|
||||||
|
|
||||||
#if defined(MAC_OS_X_VERSION_10_7)
|
#if defined(MAC_OS_X_VERSION_10_7)
|
||||||
if (*m_carbonLoopReady == false) {
|
{
|
||||||
*m_carbonLoopReady = true;
|
CLock lockCarbon(m_carbonLoopMutex);
|
||||||
m_carbonLoopReady->signal();
|
if (*m_carbonLoopReady == false) {
|
||||||
|
*m_carbonLoopReady = true;
|
||||||
|
m_carbonLoopReady->signal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2123,16 +2126,13 @@ void
|
||||||
COSXScreen::waitForCarbonLoop() const
|
COSXScreen::waitForCarbonLoop() const
|
||||||
{
|
{
|
||||||
#if defined(MAC_OS_X_VERSION_10_7)
|
#if defined(MAC_OS_X_VERSION_10_7)
|
||||||
double timeout = ARCH->time() + 5;
|
double timeout = ARCH->time() + 10;
|
||||||
m_carbonLoopReady->lock();
|
CLock lock(m_carbonLoopMutex);
|
||||||
|
|
||||||
while (!m_carbonLoopReady->wait()) {
|
while (!m_carbonLoopReady->wait()) {
|
||||||
if(ARCH->time() > timeout) {
|
if(ARCH->time() > timeout) {
|
||||||
throw std::runtime_error("carbon loop is not ready within 5 sec");
|
throw std::runtime_error("carbon loop is not ready within 5 sec");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_carbonLoopReady->unlock();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue