Client tests: Unlock mutex while processing compositor commands
Only lock the client autotest compositor mutex when necessary. This allows compositor commands to be queued while a command is being processed. Change-Id: Ib2ca6b4942f57f56f56a055cbe6ce6d876695529 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
17b2417157
commit
8184ff6bfb
@ -185,9 +185,16 @@ void MockCompositor::processCommand(const Command &command)
|
||||
|
||||
void MockCompositor::dispatchCommands()
|
||||
{
|
||||
foreach (const Command &command, m_commandQueue)
|
||||
lock();
|
||||
int count = m_commandQueue.length();
|
||||
unlock();
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
lock();
|
||||
const Command command = m_commandQueue.takeFirst();
|
||||
unlock();
|
||||
command.callback(command.target, command.parameters);
|
||||
m_commandQueue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void *MockCompositor::run(void *data)
|
||||
@ -205,8 +212,11 @@ void *MockCompositor::run(void *data)
|
||||
}
|
||||
|
||||
while (controller->m_alive) {
|
||||
QMutexLocker locker(&controller->m_mutex);
|
||||
controller->m_waitCondition.wait(&controller->m_mutex);
|
||||
{
|
||||
QMutexLocker locker(&controller->m_mutex);
|
||||
if (controller->m_commandQueue.isEmpty())
|
||||
controller->m_waitCondition.wait(&controller->m_mutex);
|
||||
}
|
||||
controller->dispatchCommands();
|
||||
compositor.dispatchEvents(20);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user