[PATCH] Change the assert in _Thread_Dispatch_decrement_disable_level

Martin Galvan martin.galvan at tallertechnologies.com
Mon Feb 2 18:37:16 UTC 2015


While cpu_self->thread_dispatch_disable_level shouldn't ever be zero,
it would be better to check it before doing the decrement.

diff --git a/cpukit/score/src/threaddispatchdisablelevel.c
b/cpukit/score/src/threaddispatchdisablelevel.c
index 3b7837c..ce33db9 100644
--- a/cpukit/score/src/threaddispatchdisablelevel.c
+++ b/cpukit/score/src/threaddispatchdisablelevel.c
@@ -107,11 +107,12 @@ uint32_t _Thread_Dispatch_decrement_disable_level( void )

   cpu_self = _Per_CPU_Get();
   disable_level = cpu_self->thread_dispatch_disable_level;
+  _Assert( disable_level > 1);
   --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( _Giant.owner_cpu != cpu_self );

   _Profiling_Thread_dispatch_enable( cpu_self, disable_level );
   _ISR_Enable_without_giant( isr_level );

-- 

Martín Galván

Software Engineer

Taller Technologies Argentina

San Lorenzo 47, 3rd Floor, Office 5

Córdoba, Argentina

Phone: 54 351 4217888 / +54 351 4218211


More information about the devel mailing list