Kaydet (Commit) 5bd1106c authored tarafından Tobias Madl's avatar Tobias Madl

Added Comments

Change-Id: I093b4812bf3b75d6a6f3c8ea38755619f5c9d151
üst 3f64e7c1
......@@ -27,6 +27,7 @@
struct ImplIdleData;
struct ImplSVData;
// The timemarks behind the priorities is the catgorizing of timer to idle
enum class IdlePriority {
VCL_IDLE_PRIORITY_STARVATIONPROTECTION = -1, // Do not use this for normal prioritizing
VCL_IDLE_PRIORITY_HIGHEST = 0, // -> 0ms
......@@ -41,16 +42,14 @@ enum class IdlePriority {
};
// To port from Timer -> Idle switch class name,
// s/Timeout/DoIdle/ etc. and select priority
class VCL_DLLPUBLIC Idle
{
protected:
ImplIdleData* mpIdleData;
IdlePriority mePriority;
IdlePriority meDefaultPriority;
bool mbActive;
Link maIdleHdl;
ImplIdleData* mpIdleData; // Pointer to element in idle list
IdlePriority mePriority; // Idle priority ( maybe divergent to default)
IdlePriority meDefaultPriority; // Default idle priority
bool mbActive; // Currently in the scheduler
Link maIdleHdl; // Callback Link
friend struct ImplIdleData;
......
......@@ -59,7 +59,7 @@ struct ImplIdleData
pMostUrgent = p;
else
{
// Find the highest priority one somehow.
// Find the highest priority.
if ( p->mpIdle->GetPriority() < pMostUrgent->mpIdle->GetPriority() )
{
IncreasePriority(pMostUrgent->mpIdle);
......@@ -77,8 +77,10 @@ struct ImplIdleData
{
switch(pIdle->GetPriority())
{
// Increase priority based on their current priority
case IdlePriority::VCL_IDLE_PRIORITY_STARVATIONPROTECTION:
break;
// If already highest priority -> extra state for starving tasks
case IdlePriority::VCL_IDLE_PRIORITY_HIGHEST:
pIdle->SetPriority(IdlePriority::VCL_IDLE_PRIORITY_STARVATIONPROTECTION);
break;
......@@ -142,7 +144,7 @@ void Idle::ProcessAllIdleHandlers()
pIdleData = pSVData->mpFirstIdleData;
while ( pIdleData )
{
// Was timer destroyed in the meantime?
// Was Idle destroyed in the meantime?
if ( pIdleData->mbDelete )
{
if ( pPrevIdleData )
......@@ -166,6 +168,8 @@ void Idle::ProcessAllIdleHandlers()
void Idle::SetPriority( IdlePriority ePriority )
{
mePriority = ePriority;
// Was a new priority set before excecution?
// Then take it as default priority
if( !mbActive && meDefaultPriority == IdlePriority::VCL_IDLE_PRIORITY_DEFAULT )
meDefaultPriority = mePriority;
}
......@@ -177,12 +181,13 @@ void Idle::DoIdle()
void Idle::Start()
{
// Mark timer active
mbActive = true;
ImplSVData* pSVData = ImplGetSVData();
if ( !mpIdleData )
{
// insert timer and start
// insert Idle
mpIdleData = new ImplIdleData;
mpIdleData->mpIdle = this;
mpIdleData->mbInIdle = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment