Fix vTaskSuspendAll assert for critical nesting count (#1029)

* Accessing the critical nesting count in current task's TCB is performed with interrupt disabled to ensure atomicity.
This commit is contained in:
chinglee-iot 2024-04-11 15:12:03 +08:00 committed by GitHub
parent 73851fb6da
commit 4d4f8d0d50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3831,9 +3831,6 @@ void vTaskSuspendAll( void )
if( xSchedulerRunning != pdFALSE )
{
/* This must never be called from inside a critical section. */
configASSERT( portGET_CRITICAL_NESTING_COUNT() == 0 );
/* Writes to uxSchedulerSuspended must be protected by both the task AND ISR locks.
* We must disable interrupts before we grab the locks in the event that this task is
* interrupted and switches context before incrementing uxSchedulerSuspended.
@ -3841,6 +3838,9 @@ void vTaskSuspendAll( void )
* uxSchedulerSuspended since that will prevent context switches. */
ulState = portSET_INTERRUPT_MASK();
/* This must never be called from inside a critical section. */
configASSERT( portGET_CRITICAL_NESTING_COUNT() == 0 );
/* portSOFRWARE_BARRIER() is only implemented for emulated/simulated ports that
* do not otherwise exhibit real time behaviour. */
portSOFTWARE_BARRIER();