Sync search updates using BlockingQueuedConnection
ClosedPublic

Authored by dkurz on Aug 3 2017, 7:23 PM.

Details

Reviewers
dvratil
Group Reviewers
KDE PIM

Diff Detail

Repository
R165 Akonadi
Lint
Lint Skipped
Unit
Unit Tests Skipped
dkurz created this revision.Aug 3 2017, 7:23 PM
dvratil requested changes to this revision.Aug 4 2017, 9:02 AM
dvratil added a subscriber: dvratil.

SearchManager::updateSearch() can be called from arbitrary thread, but it's important that SearchManager::updateSearchImpl() is executed in SearchManager's thread, your change break this. We should probably add Q_ASSERT(QThread::currentThread() == thread()); at the beginning of updateSearchImpl() and properly documented the requirement (it's not very obvious from the comment in the header).

Also good point with the FIXME, probably need to do something like storing a QWaitConditions in the mUpdatingCollections vector so that others can wait and be notified when the search is finished.

src/server/search/searchmanager.cpp
273

Replace Qt::QueuedConnection by Qt::BlockingQueuedConnection and you can still remove the QSemaphore. No idea why I did not use that in the first place... :-)

This revision now requires changes to proceed.Aug 4 2017, 9:02 AM
dkurz updated this revision to Diff 17698.Aug 4 2017, 9:46 AM
dkurz edited edge metadata.
dkurz retitled this revision from Simplify search synchronization to Sync search updates using BlockingQueuedConnection.
dkurz edited the summary of this revision. (Show Details)
dkurz marked an inline comment as done.Aug 4 2017, 9:49 AM
dvratil accepted this revision.Aug 4 2017, 9:58 AM

Thank you!

This revision is now accepted and ready to land.Aug 4 2017, 9:58 AM
dkurz closed this revision.Aug 10 2017, 4:07 PM