[PATCH 6/6] Thread Queue: Merge discipline subroutines into main methods

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Sep 19 12:28:36 UTC 2014


On 08/07/14 22:52, Joel Sherrill wrote:
> There was a lot of duplication between the discipline subroutines.
> With the transition to RBTrees for priority discipline, there were
> only a few lines of source code manipulating the data structure
> for FIFO and priority. Thus is made sense to fold these back
> into the main methods.
>
> As part of doing this all of the tests for discipline were changed
> to be in the same order.
[...]
> diff --git a/cpukit/score/src/threadqdequeue.c b/cpukit/score/src/threadqdequeue.c
> index 93d5c07..3b55e52 100644
> --- a/cpukit/score/src/threadqdequeue.c
> +++ b/cpukit/score/src/threadqdequeue.c
[...]
> +  /*
> +   * We did not find a thread to unblock.
> +   */
> +  if ( !the_thread ) {
> +    sync_state = the_thread_queue->sync_state;
> +    if ( (sync_state == THREAD_BLOCKING_OPERATION_TIMEOUT) ||
> +         (sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED) ) {
> +      the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_SATISFIED;
> +      the_thread = _Thread_Executing;
>       }
> -  _ISR_Enable( level );
> +    _ISR_Enable( level );
> +    return NULL;
> +  }

This introduced a serious bug and its pretty sad that the test suite didn't 
find it.  This is one of the core routines and we had no proper test case for it.

In case we set the_thread_queue->sync_state = 
THREAD_BLOCKING_OPERATION_SATISFIED we must not return NULL.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the devel mailing list