Diffusion Baloo b13453360685

[Scheduler] Use flag to track when a runner is going idle

Authored by bruns on Oct 16 2018, 10:22 PM.

Description

[Scheduler] Use flag to track when a runner is going idle

Summary:
Only one runner should be queued/running at a given time, but the current
condition "m_threadPool.activeThreadCount == 0" is to strong, as the
done() signal is fired from the runner thread while it is still alive and
the signal may be processed before the thread has exited.

Set a flag when the runner is finished, and use this to guard from
scheduling/enqueuing multiple runners. It is fine to enqueue another
runner while the old is cleaning up, the new one will become active
afterwards.

Alternative approach to D15959.

Test Plan:
start `balooctl monitor~
touch a file -> file is indexed, scheduler goes idle afterwards
touch multiple files, new files -> indexing, idle

Reviewers: Baloo, Frameworks, poboiko, ngraham, lbeltrame

Reviewed By: lbeltrame

Subscribers: lbeltrame, kde-frameworks-devel

Tags: Frameworks, Baloo

Differential Revision: https://phabricator.kde.org/D16265