forked from qt-creator/qt-creator
Use QMutexLocker in conjunction with QWaitCondition
Change-Id: Ia5d55b9161a58387b0806e792f0fb1b21f118330 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -168,12 +168,11 @@ void SpotlightIterator::ensureNext()
|
|||||||
if (m_index + 1 < m_filePaths.size()) // nothing to do
|
if (m_index + 1 < m_filePaths.size()) // nothing to do
|
||||||
return;
|
return;
|
||||||
// check if there are items in the queue, otherwise wait for some
|
// check if there are items in the queue, otherwise wait for some
|
||||||
m_mutex.lock();
|
QMutexLocker lock(&m_mutex);
|
||||||
if (m_queue.isEmpty() && !m_finished)
|
if (m_queue.isEmpty() && !m_finished)
|
||||||
m_waitForItems.wait(&m_mutex);
|
m_waitForItems.wait(&m_mutex);
|
||||||
m_filePaths.append(m_queue);
|
m_filePaths.append(m_queue);
|
||||||
m_queue.clear();
|
m_queue.clear();
|
||||||
m_mutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// #pragma mark -- SpotlightLocatorFilter
|
// #pragma mark -- SpotlightLocatorFilter
|
||||||
|
Reference in New Issue
Block a user