Updated tasks.c checks for scheduler suspension (#670)
This commit updates the checks for the variable uxSchedulerSuspended in
tasks.c module to use a uniform format.
Signed-off-by: Sudeep Mohanty <sudp.mohanty@gmail.com>
diff --git a/tasks.c b/tasks.c
index befd63e..59f9622 100644
--- a/tasks.c
+++ b/tasks.c
@@ -387,7 +387,7 @@
* kernel to move the task from the pending ready list into the real ready list
* when the scheduler is unsuspended. The pending ready list itself can only be
* accessed from a critical section. */
-PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) pdFALSE;
+PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) 0U;
#if ( configGENERATE_RUN_TIME_STATS == 1 )
@@ -1200,7 +1200,7 @@
{
if( pxTCB == pxCurrentTCB )
{
- configASSERT( uxSchedulerSuspended == 0 );
+ configASSERT( uxSchedulerSuspended == ( UBaseType_t ) 0U );
portYIELD_WITHIN_API();
}
else
@@ -1223,7 +1223,7 @@
configASSERT( pxPreviousWakeTime );
configASSERT( ( xTimeIncrement > 0U ) );
- configASSERT( uxSchedulerSuspended == 0 );
+ configASSERT( uxSchedulerSuspended == ( UBaseType_t ) 0U );
vTaskSuspendAll();
{
@@ -1309,7 +1309,7 @@
/* A delay time of zero just forces a reschedule. */
if( xTicksToDelay > ( TickType_t ) 0U )
{
- configASSERT( uxSchedulerSuspended == 0 );
+ configASSERT( uxSchedulerSuspended == ( UBaseType_t ) 0U );
vTaskSuspendAll();
{
traceTASK_DELAY();
@@ -1748,7 +1748,7 @@
if( xSchedulerRunning != pdFALSE )
{
/* The current task has just been suspended. */
- configASSERT( uxSchedulerSuspended == 0 );
+ configASSERT( uxSchedulerSuspended == ( UBaseType_t ) 0U );
portYIELD_WITHIN_API();
}
else
@@ -1914,7 +1914,7 @@
traceTASK_RESUME_FROM_ISR( pxTCB );
/* Check the ready lists can be accessed. */
- if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
+ if( uxSchedulerSuspended == ( UBaseType_t ) 0U )
{
/* Ready lists can be accessed so move the task from the
* suspended list to the ready list directly. */
@@ -2183,7 +2183,7 @@
/* If uxSchedulerSuspended is zero then this function does not match a
* previous call to vTaskSuspendAll(). */
- configASSERT( uxSchedulerSuspended );
+ configASSERT( uxSchedulerSuspended != ( UBaseType_t ) 0U );
/* It is possible that an ISR caused a task to be removed from an event
* list while the scheduler was suspended. If this was the case then the
@@ -2194,7 +2194,7 @@
{
--uxSchedulerSuspended;
- if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
+ if( uxSchedulerSuspended == ( UBaseType_t ) 0U )
{
if( uxCurrentNumberOfTasks > ( UBaseType_t ) 0U )
{
@@ -2642,7 +2642,7 @@
/* Arrange for xTickCount to reach xNextTaskUnblockTime in
* xTaskIncrementTick() when the scheduler resumes. This ensures
* that any delayed tasks are resumed at the correct time. */
- configASSERT( uxSchedulerSuspended );
+ configASSERT( uxSchedulerSuspended != ( UBaseType_t ) 0U );
configASSERT( xTicksToJump != ( TickType_t ) 0 );
/* Prevent the tick interrupt modifying xPendedTicks simultaneously. */
@@ -2671,7 +2671,7 @@
/* Must not be called with the scheduler suspended as the implementation
* relies on xPendedTicks being wound down to 0 in xTaskResumeAll(). */
- configASSERT( uxSchedulerSuspended == 0 );
+ configASSERT( uxSchedulerSuspended == ( UBaseType_t ) 0U );
/* Use xPendedTicks to mimic xTicksToCatchUp number of ticks occurring when
* the scheduler is suspended so the ticks are executed in xTaskResumeAll(). */
@@ -2780,7 +2780,7 @@
* tasks to be unblocked. */
traceTASK_INCREMENT_TICK( xTickCount );
- if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
+ if( uxSchedulerSuspended == ( UBaseType_t ) 0U )
{
/* Minor optimisation. The tick count cannot change in this
* block. */
@@ -3060,7 +3060,7 @@
void vTaskSwitchContext( void )
{
- if( uxSchedulerSuspended != ( UBaseType_t ) pdFALSE )
+ if( uxSchedulerSuspended != ( UBaseType_t ) 0U )
{
/* The scheduler is currently suspended - do not allow a context
* switch. */
@@ -3165,7 +3165,7 @@
/* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by
* the event groups implementation. */
- configASSERT( uxSchedulerSuspended != 0 );
+ configASSERT( uxSchedulerSuspended != ( UBaseType_t ) 0U );
/* Store the item value in the event list item. It is safe to access the
* event list item here as interrupts won't access the event list item of a
@@ -3240,7 +3240,7 @@
configASSERT( pxUnblockedTCB );
listREMOVE_ITEM( &( pxUnblockedTCB->xEventListItem ) );
- if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
+ if( uxSchedulerSuspended == ( UBaseType_t ) 0U )
{
listREMOVE_ITEM( &( pxUnblockedTCB->xStateListItem ) );
prvAddTaskToReadyList( pxUnblockedTCB );
@@ -3293,7 +3293,7 @@
/* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by
* the event flags implementation. */
- configASSERT( uxSchedulerSuspended != pdFALSE );
+ configASSERT( uxSchedulerSuspended != ( UBaseType_t ) 0U );
/* Store the new item value in the event list. */
listSET_LIST_ITEM_VALUE( pxEventListItem, xItemValue | taskEVENT_LIST_ITEM_VALUE_IN_USE );
@@ -4093,7 +4093,7 @@
}
else
{
- if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
+ if( uxSchedulerSuspended == ( UBaseType_t ) 0U )
{
xReturn = taskSCHEDULER_RUNNING;
}
@@ -5113,7 +5113,7 @@
/* The task should not have been on an event list. */
configASSERT( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) == NULL );
- if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
+ if( uxSchedulerSuspended == ( UBaseType_t ) 0U )
{
listREMOVE_ITEM( &( pxTCB->xStateListItem ) );
prvAddTaskToReadyList( pxTCB );
@@ -5204,7 +5204,7 @@
/* The task should not have been on an event list. */
configASSERT( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) == NULL );
- if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
+ if( uxSchedulerSuspended == ( UBaseType_t ) 0U )
{
listREMOVE_ITEM( &( pxTCB->xStateListItem ) );
prvAddTaskToReadyList( pxTCB );