[PING][PATCH v2] Change the assert in _Thread_Dispatch_decrement_disable_level

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Apr 17 10:18:18 UTC 2015


I checked in a slightly modified version.

On 16/04/15 16:27, Martin Galvan wrote:
> While cpu_self->thread_dispatch_disable_level shouldn't ever be zero, it would be better to check it before doing the decrement.
>
> Changes in v2:
>   * Modified the asserts as requested in https://lists.rtems.org/pipermail/devel/2015-February/009821.html.
> ---
>   cpukit/score/src/threaddispatchdisablelevel.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/score/src/threaddispatchdisablelevel.c b/cpukit/score/src/threaddispatchdisablelevel.c
> index 158fc39..6043fe7 100644
> --- a/cpukit/score/src/threaddispatchdisablelevel.c
> +++ b/cpukit/score/src/threaddispatchdisablelevel.c
> @@ -107,11 +107,15 @@ uint32_t _Thread_Dispatch_decrement_disable_level( void )
>
>     cpu_self = _Per_CPU_Get();
>     disable_level = cpu_self->thread_dispatch_disable_level;
> +  _Assert( disable_level > 0);
>     --disable_level;
>     cpu_self->thread_dispatch_disable_level = disable_level;
>
>     _Giant_Do_release( cpu_self );
> -  _Assert( disable_level != 0 || _Giant.owner_cpu != cpu_self );
> +
> +  _Assert( ( disable_level == 0 && _Giant.owner_cpu != cpu_self )
> +    || ( disable_level != 0 && _Giant.owner_cpu == cpu_self )
> +  );
>
>     _Profiling_Thread_dispatch_enable( cpu_self, disable_level );
>     _ISR_Enable_without_giant( isr_level );
> --
> 2.3.4

-- 
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