LibreOffice Module vcl (master)  1
Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Friends | List of all members
Scheduler Class Referencefinal

#include <scheduler.hxx>

Static Public Member Functions

static void ImplDeInitScheduler ()
static void CallbackTaskScheduling ()
 Process one pending Timer with highest priority. More...
static bool ProcessTaskScheduling ()
 Process one pending task ahead of time with highest priority. More...
static void ProcessEventsToIdle ()
 Process all events until none is pending. More...
static void Wakeup ()
 Wakes up the scheduler. More...
static void SetDeterministicMode (bool bDeterministic)
 Control the deterministic mode. More...
static bool GetDeterministicMode ()
 Return the current state of deterministic mode. More...

Static Public Attributes

static constexpr sal_uInt64 ImmediateTimeoutMs = 0
static constexpr sal_uInt64 InfiniteTimeoutMs = SAL_MAX_UINT64

Private Member Functions

 Scheduler ()=delete

Static Private Member Functions

static void UpdateSystemTimer (ImplSchedulerContext &rSchedCtx, sal_uInt64 nMinPeriod, bool bForce, sal_uInt64 nTime)
static void ImplStartTimer (sal_uInt64 nMS, bool bForce, sal_uInt64 nTime)
 Start a new timer if we need to for nMS duration. More...
static void Lock (sal_uInt32 nLockCount=1)
static sal_uInt32 Unlock (bool bUnlockAll=false)


class SchedulerGuard
class Task

Detailed Description

Definition at line 27 of file scheduler.hxx.

Constructor & Destructor Documentation

Scheduler::Scheduler ( )

Member Function Documentation

void Scheduler::CallbackTaskScheduling ( )

Process one pending Timer with highest priority.

Definition at line 284 of file scheduler.cxx.

References ProcessTaskScheduling().

Referenced by ImplStartTimer().

bool Scheduler::GetDeterministicMode ( )

Return the current state of deterministic mode.

Definition at line 297 of file scheduler.cxx.

References g_bDeterministicMode.

Referenced by Idle::Start().

void Scheduler::ImplDeInitScheduler ( )
void Scheduler::ImplStartTimer ( sal_uInt64  nMS,
bool  bForce,
sal_uInt64  nTime 

Start a new timer if we need to for nMS duration.

if this is longer than the existing duration we're waiting for, do nothing - unless bForce - which means to reset the minimum period; used by the scheduled itself.

Definition at line 252 of file scheduler.cxx.

References assert(), CallbackTaskScheduling(), SalInstance::CreateSalTimer(), if(), ImplGetSVData(), InfiniteTimeoutMs, ImplSVData::maSchedCtx, ImplSchedulerContext::mbActive, ImplSchedulerContext::mnTimerPeriod, ImplSchedulerContext::mnTimerStart, ImplSVData::mpDefInst, ImplSchedulerContext::mpSalTimer, SAL_INFO, SAL_MAX_UINT64, SalTimer::SetCallback(), and SalTimer::Start().

Referenced by Task::StartTimer(), UpdateSystemTimer(), and Wakeup().

void Scheduler::Lock ( sal_uInt32  nLockCount = 1)
void Scheduler::ProcessEventsToIdle ( )

Process all events until none is pending.

This can busy-lock, if some task or system event always generates new events when being processed. Most time it's called in unit tests to process all pending events. Internally it just calls Application::Reschedule( true ) until it fails.

See also

Definition at line 471 of file svapp.cxx.

References Task::GetDebugName(), ImplGetSVData(), Task::IsActive(), SalInstance::IsMainThread(), ImplSVData::maSchedCtx, ImplSchedulerData::mbInScheduler, ImplSVData::mpDefInst, ImplSchedulerContext::mpFirstSchedulerData, ImplSchedulerData::mpNext, ImplSchedulerData::mpTask, PRIO_COUNT, Application::Reschedule(), and SAL_WARN.

Referenced by ImplDeInitScheduler(), and unit_lok_process_events_to_idle().

bool Scheduler::ProcessTaskScheduling ( )
void Scheduler::SetDeterministicMode ( bool  bDeterministic)

Control the deterministic mode.

In this mode, two subsequent runs of LibreOffice fire about the same amount idles.

Definition at line 292 of file scheduler.cxx.

sal_uInt32 Scheduler::Unlock ( bool  bUnlockAll = false)
void Scheduler::UpdateSystemTimer ( ImplSchedulerContext rSchedCtx,
sal_uInt64  nMinPeriod,
bool  bForce,
sal_uInt64  nTime 
void Scheduler::Wakeup ( )

Wakes up the scheduler.

This doesn't handle any events! It just ensures the Scheduler is run as soon as possible by forcing the Scheduler timer to fire.

Can be used for complex UpdateMinPeriod function, where the task is actually active but not ready and we want to skip the Task::Start() queue append for faster reaction.

Definition at line 542 of file scheduler.cxx.

References tools::Time::GetSystemTicks(), and ImplStartTimer().

Friends And Related Function Documentation

friend class SchedulerGuard

Definition at line 29 of file scheduler.hxx.

friend class Task

Definition at line 30 of file scheduler.hxx.

Member Data Documentation

constexpr sal_uInt64 Scheduler::ImmediateTimeoutMs = 0
constexpr sal_uInt64 Scheduler::InfiniteTimeoutMs = SAL_MAX_UINT64

The documentation for this class was generated from the following files: