Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
Merge branch 'bugfix/config_assert_thread_safety' into 'master'
Browse files Browse the repository at this point in the history
freertos: Fix configASSERT thread safety

Closes IDFGH-2055

See merge request espressif/esp-idf!6612
  • Loading branch information
projectgus committed Nov 12, 2019
2 parents 8325a29 + 79e74e5 commit 12de58b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/freertos/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
//No mux; no harm done if this misfires. The deleted task won't get scheduled anyway.
if( pxTCB == pxCurrentTCB[ core ] ) //If task was currently running on this core
{
configASSERT( uxSchedulerSuspended[ core ] == 0 );
configASSERT( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )

/* The pre-delete hook is primarily for the Windows simulator,
in which Windows specific clean up operations are performed,
Expand Down Expand Up @@ -1336,7 +1336,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode

configASSERT( pxPreviousWakeTime );
configASSERT( ( xTimeIncrement > 0U ) );
configASSERT( uxSchedulerSuspended[ xPortGetCoreID() ] == 0 );
configASSERT( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING );

taskENTER_CRITICAL(&xTaskQueueMutex);
// vTaskSuspendAll();
Expand Down Expand Up @@ -1434,7 +1434,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
/* A delay time of zero just forces a reschedule. */
if( xTicksToDelay > ( TickType_t ) 0U )
{
configASSERT( uxSchedulerSuspended[ xPortGetCoreID() ] == 0 );
configASSERT( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING );
taskENTER_CRITICAL(&xTaskQueueMutex);
// vTaskSuspendAll();
{
Expand Down Expand Up @@ -1817,7 +1817,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
if( xSchedulerRunning != pdFALSE )
{
/* The current task has just been suspended. */
configASSERT( uxSchedulerSuspended[ xPortGetCoreID() ] == 0 );
configASSERT( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING );
portYIELD_WITHIN_API();
}
else
Expand Down Expand Up @@ -2213,7 +2213,7 @@ BaseType_t xAlreadyYielded = pdFALSE;

/* If uxSchedulerSuspended[ xPortGetCoreID() ] is zero then this function does not match a
previous call to vTaskSuspendAll(). */
configASSERT( uxSchedulerSuspended[ xPortGetCoreID() ] );
configASSERT( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED );
/* 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
removed task will have been added to the xPendingReadyList. Once the
Expand Down

0 comments on commit 12de58b

Please sign in to comment.