This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
minor simplification in mlqueue.cxx (schedule)
- From: sandeep <shimple0 at yahoo dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Sat, 20 Nov 2004 18:00:07 +0530
- Subject: [ECOS] minor simplification in mlqueue.cxx (schedule)
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