Details
-
Improvement
-
Resolution: Fixed
-
Major
-
None
-
master
Description
Loosely related to MB-26831
A number of tasks exist which have similar trigger mechanisms,
- BgFetcher::run(GlobalTask *task)
- ItemPager::run
- ActiveStreamCheckpointProcessorTask::run
The atomic 'notified' logic should be moved up to a base-class (maybe GlobalTask) along with the wake mechanism, then the task's run function can be 'wrapped' in GlobalTask run who performs the common steps which exist to prevent lost wakeups.
bool BaseTask::run() {
|
snooze(INT_MAX);
|
notified = false;
|
bool rv = derived::run();
|
if (derived::moreWork()) { // note derived::moreWork would check the queue in ActiveStreamCheckpointProcessorTask
|
wakeUp();
|
}
|
return rv;
|
}
|
We can also consider a way to clearly implement/separate triggered tasks from periodic tasks with some restructuring of GlobalTask->PeriodicTask->*Task