Add a TaskStopwatch to interrupt idle loops

Desktop / LibreOffice - Jan-Marek Glogowski [] - 13 August 2019 14:53 EDT

If we have multiple pending Idles, they will interrupt / starve each other, because there will be an instant pending timeout for the next Idle.

This patch introduces a time slice to tasks, so long running events can use a TaskStopwatch to do the real interrupt after running out of their time slice. Apart from the time, this breaks when AnyInput is available, except for the timer event.

This class just helps to track the time, as the scheduler is coop, not preemptive.

Change-Id: I9d0b4a5aa388ebdf496b355d100152d890224524 Reviewed-on:

6e13585508ca Add a TaskStopwatch to interrupt idle loops
include/vcl/TaskStopwatch.hxx | 123 ++++++++++++++++++++++++++++++++++++++++++
vcl/ | 1 +
vcl/README.scheduler | 59 ++++++++++++++++++--
vcl/qa/cppunit/timer.cxx | 78 +++++++++++++++++++++++++++
vcl/source/app/scheduler.cxx | 3 ++
5 files changed, 259 insertions(+), 5 deletions(-)


  • Share