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 ()
 System timer callback function, which processes one LO task. 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 ()
 
static void Unlock ()
 

Friends

class SchedulerGuard
 
class Task
 

Detailed Description

Definition at line 27 of file scheduler.hxx.

Constructor & Destructor Documentation

◆ Scheduler()

Scheduler::Scheduler ( )
privatedelete

Member Function Documentation

◆ CallbackTaskScheduling()

void Scheduler::CallbackTaskScheduling ( )
static

◆ GetDeterministicMode()

bool Scheduler::GetDeterministicMode ( )
static

Return the current state of deterministic mode.

Definition at line 269 of file scheduler.cxx.

References g_bDeterministicMode.

Referenced by Idle::Start().

◆ ImplDeInitScheduler()

void Scheduler::ImplDeInitScheduler ( )
static

◆ ImplStartTimer()

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

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 230 of file scheduler.cxx.

References 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().

◆ Lock()

void Scheduler::Lock ( )
staticprivate

◆ ProcessEventsToIdle()

void Scheduler::ProcessEventsToIdle ( )
static

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
Application::Reschedule

Definition at line 379 of file svapp.cxx.

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

Referenced by UIObjectUnoObj::executeAction(), ImplDeInitScheduler(), and unit_lok_process_events_to_idle().

◆ SetDeterministicMode()

void Scheduler::SetDeterministicMode ( bool  bDeterministic)
static

Control the deterministic mode.

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

Definition at line 264 of file scheduler.cxx.

References g_bDeterministicMode.

◆ Unlock()

void Scheduler::Unlock ( )
staticprivate

◆ UpdateSystemTimer()

void Scheduler::UpdateSystemTimer ( ImplSchedulerContext rSchedCtx,
sal_uInt64  nMinPeriod,
bool  bForce,
sal_uInt64  nTime 
)
inlinestaticprivate

◆ Wakeup()

void Scheduler::Wakeup ( )
static

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 539 of file scheduler.cxx.

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

Friends And Related Function Documentation

◆ SchedulerGuard

friend class SchedulerGuard
friend

Definition at line 29 of file scheduler.hxx.

◆ Task

friend class Task
friend

Definition at line 30 of file scheduler.hxx.

Member Data Documentation

◆ ImmediateTimeoutMs

constexpr sal_uInt64 Scheduler::ImmediateTimeoutMs = 0
staticconstexpr

◆ InfiniteTimeoutMs

constexpr sal_uInt64 Scheduler::InfiniteTimeoutMs = SAL_MAX_UINT64
staticconstexpr

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