diff options
author | Tobias Madl <tobias.madl.dev@gmail.com> | 2015-03-06 10:39:49 +0000 |
---|---|---|
committer | Tobias Madl <tobias.madl.dev@gmail.com> | 2015-03-06 12:27:12 +0000 |
commit | 01f406bc28f53acc5a2734af637aa8074a5d1813 (patch) | |
tree | 43b42f4730a775e092a6ff809a006449f9f47975 /vcl/source | |
parent | b6bb2e9315c9bc3338eaf066df40a969eb4774aa (diff) |
adapted comments and variable names
Change-Id: I4f2c1d743ce2f30e8c24180b73f0716fc13b459e
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/scheduler.cxx | 35 | ||||
-rw-r--r-- | vcl/source/app/timer.cxx | 3 |
2 files changed, 22 insertions, 16 deletions
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index fc52b905426c..5a0061f4cccf 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -23,11 +23,14 @@ #include <vcl/timer.hxx> #include <saltimer.hxx> +#define MAX_TIMER_PERIOD ((sal_uLong)0xFFFFFFFF) + void ImplSchedulerData::Invoke() { if (mbDelete || mbInScheduler ) return; + // prepare Scheduler Object for deletion after handling mpScheduler->SetDeletionFlags(); // invoke it @@ -41,20 +44,20 @@ ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimer ) ImplSVData* pSVData = ImplGetSVData(); ImplSchedulerData *pMostUrgent = NULL; - for ( ImplSchedulerData *p = pSVData->mpFirstSchedulerData; p; p = p->mpNext ) + for ( ImplSchedulerData *pSchedulerData = pSVData->mpFirstSchedulerData; pSchedulerData; pSchedulerData = pSchedulerData->mpNext ) { - if ( !p->mpScheduler || p->mbDelete || p->mnUpdateStack >= pSVData->mnTimerUpdate || !p->mpScheduler->ReadyForSchedule( bTimer ) ) + if ( !pSchedulerData->mpScheduler || pSchedulerData->mbDelete || pSchedulerData->mnUpdateStack >= pSVData->mnUpdateStack + || !pSchedulerData->mpScheduler->ReadyForSchedule( bTimer ) ) continue; if (!pMostUrgent) - pMostUrgent = p; + pMostUrgent = pSchedulerData; else { // Find the highest priority. - // If the priority of the current idle is higher (numerical value is lower) than - // the priority of the most urgent, the priority of most urgent is increased and - // the current is the new most urgent. So starving is impossible. - if ( p->mpScheduler->GetPriority() < pMostUrgent->mpScheduler->GetPriority() ) - pMostUrgent = p; + // If the priority of the current task is higher (numerical value is lower) than + // the priority of the most urgent, the current task gets the new most urgent. + if ( pSchedulerData->mpScheduler->GetPriority() < pMostUrgent->mpScheduler->GetPriority() ) + pMostUrgent = pSchedulerData; } } @@ -101,6 +104,7 @@ void Scheduler::ImplDeInitScheduler() void Scheduler::CallbackTaskScheduling(bool ignore) { + // this function is for the saltimer callback (void)ignore; Scheduler::ProcessTaskScheduling( true ); } @@ -108,12 +112,13 @@ void Scheduler::CallbackTaskScheduling(bool ignore) void Scheduler::ProcessTaskScheduling( bool bTimer ) { // process all pending Tasks + // if bTimer True, only handle timer ImplSchedulerData* pSchedulerData = NULL; ImplSchedulerData* pPrevSchedulerData = NULL; ImplSVData* pSVData = ImplGetSVData(); sal_uLong nTime = tools::Time::GetSystemTicks(); - sal_uLong nMinPeriod = ((sal_uLong)0xFFFFFFFF); - pSVData->mnTimerUpdate++; + sal_uLong nMinPeriod = MAX_TIMER_PERIOD; + pSVData->mnUpdateStack++; if ((pSchedulerData = ImplSchedulerData::GetMostImportantTask(bTimer))) { @@ -156,15 +161,17 @@ void Scheduler::ProcessTaskScheduling( bool bTimer ) { if ( pSVData->mpSalTimer ) pSVData->mpSalTimer->Stop(); - pSVData->mnTimerPeriod = ((sal_uLong)0xFFFFFFFF); + pSVData->mnTimerPeriod = MAX_TIMER_PERIOD; } else Timer::ImplStartTimer( pSVData, nMinPeriod ); - pSVData->mnTimerUpdate--; + pSVData->mnUpdateStack--; } sal_uLong Scheduler::UpdateMinPeriod( sal_uLong nMinPeriod, sal_uLong nTime ) { + // this period is only usefull for timer + // so in this implementation it' only a pass through (void)nTime; return nMinPeriod; } @@ -182,7 +189,7 @@ void Scheduler::Start() ImplSVData* pSVData = ImplGetSVData(); if ( !mpSchedulerData ) { - // insert Idle + // insert Scheduler mpSchedulerData = new ImplSchedulerData; mpSchedulerData->mpScheduler = this; mpSchedulerData->mbInScheduler = false; @@ -203,7 +210,7 @@ void Scheduler::Start() } mpSchedulerData->mbDelete = false; mpSchedulerData->mnUpdateTime = tools::Time::GetSystemTicks(); - mpSchedulerData->mnUpdateStack = pSVData->mnTimerUpdate; + mpSchedulerData->mnUpdateStack = pSVData->mnUpdateStack; } void Scheduler::Stop() diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx index ac7bb5ffd306..b4389fe8dbc4 100644 --- a/vcl/source/app/timer.cxx +++ b/vcl/source/app/timer.cxx @@ -22,7 +22,6 @@ #include <saltimer.hxx> #include <svdata.hxx> #include <salinst.hxx> -#include <vcl/scheduler.hxx> #define MAX_TIMER_PERIOD ((sal_uLong)0xFFFFFFFF) @@ -122,7 +121,7 @@ void Timer::SetTimeout( sal_uLong nNewTimeout ) if ( mbActive ) { ImplSVData* pSVData = ImplGetSVData(); - if ( !pSVData->mnTimerUpdate && (mnTimeout < pSVData->mnTimerPeriod) ) + if ( !pSVData->mnUpdateStack && (mnTimeout < pSVData->mnTimerPeriod) ) Timer::ImplStartTimer( pSVData, mnTimeout ); } } |