[ECOS] minor simplification in mlqueue.cxx (schedule)

sandeep shimple0@yahoo.com
Sat Nov 20 14:03:00 GMT 2004


Won't it be clearer, if following code fragment from 
"Cyg_Scheduler_Implementation::schedule(void)" in mlqueue.cxx

-----------------------------------------------------------------
// If the current thread is still runnable, return it to pending
// state so that it can be considered alongside any other threads
// for execution.
if( current->get_state() == Cyg_Thread::RUNNING )
{
     current->cpu = CYG_KERNEL_CPU_NONE;
     pending[current->priority]++;
     pending_map |= (1<<current->priority);
}
else
{
     // Otherwise, ensure that the thread is no longer marked as
     // running.
     current->cpu = CYG_KERNEL_CPU_NONE;
}
-------------------------------------------------------------------

is simplified to

-----------------------------------------------------------------
// If the current thread is still runnable, return it to pending
// state so that it can be considered alongside any other threads
// for execution.
if( current->get_state() == Cyg_Thread::RUNNING )
{
     pending[current->priority]++;
     pending_map |= (1<<current->priority);
}

// ensure that the thread is no longer marked as running.
current->cpu = CYG_KERNEL_CPU_NONE;
-------------------------------------------------------------------

since setting the current cpu to NONE is common action for both - then and else.

is there some reason that things have been kept the way they are?

---
sandeep


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list