This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Is this a bug
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: TomChen <chenqy_79 at 163 dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: 24 Sep 2004 16:05:19 +0100
- Subject: Re: [ECOS] Is this a bug
- References: <41542DF2.2070007@163.com>
TomChen <chenqy_79@163.com> writes:
> Hi All,
>
> Kernel package src/sched/mlqueue.cxx
> in function Cyg_ThreadQueue_Implementation::enqueue(Cyg_Thread *thread) ,
>
> When there is more than one thread in the queue and the priority is
> neither higer than the head nor lower than the tail, we have to search
> the queue to find the place. The code for this is:
>
> Cyg_Thread *qtmp = get_tail();
> while ( thread->priority > qtmp->priority)
> qtmp = qtmp->get_prev();
> qtmp->append( thread );
>
> I think this should be:
>
> Cyg_Thread *qtmp = get_tail();
> while ( thread->priority *<* qtmp->priority)
> qtmp = qtmp->get_prev();
> qtmp->append( thread );
I believe the original code it correct.
Remember that the priorities go from 0=highest to 31=lowest. So the
loop spins while the thread priorities are numerically greater than
the one we want to insert. Once we find one that is less than or equal
we break out and install the new thread just after it.
--
Nick Garnett eCos Kernel Architect
http://www.ecoscentric.com/ The eCos and RedBoot experts
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss