priority inversion in _Thread_queue_Enqueue_priority() ?
Joel Sherrill
joel.sherrill at OARcorp.com
Fri Feb 4 16:18:24 UTC 2000
Andrew Klossner wrote:
>
> In exec/score/src/threadq.c: _Thread_queue_Enqueue_priority, we have:
>
> Priority_Control search_priority;
> ...
> search_priority = PRIORITY_MINIMUM - 1;
>
> Priority_Control is unsigned. PRIORITY_MINIMUM is 0. This ends up
> assigning (with my compiler) UINT_MAX to search_priority. With all
> the gotos in this function, I'm not confident that I understand all
> the ramifications. Is the way the code is expected to work?
It works correctly since this line of code is really only ensuring that
is the thread queue is empty, you can fall out of the loop, fail the
"equal priority test" and use the insert code there.
The constant "PRIORITY_MINIMUM - 1" is probably ill chosen but it works.
> -=- Andrew Klossner (andrew at pogo.wv.tek.com)
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list