Skip to content

Commit 4d4f8d0

Browse files
authored
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.
1 parent 73851fb commit 4d4f8d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tasks.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,16 +3831,16 @@ void vTaskSuspendAll( void )
38313831

38323832
if( xSchedulerRunning != pdFALSE )
38333833
{
3834-
/* This must never be called from inside a critical section. */
3835-
configASSERT( portGET_CRITICAL_NESTING_COUNT() == 0 );
3836-
38373834
/* Writes to uxSchedulerSuspended must be protected by both the task AND ISR locks.
38383835
* We must disable interrupts before we grab the locks in the event that this task is
38393836
* interrupted and switches context before incrementing uxSchedulerSuspended.
38403837
* It is safe to re-enable interrupts after releasing the ISR lock and incrementing
38413838
* uxSchedulerSuspended since that will prevent context switches. */
38423839
ulState = portSET_INTERRUPT_MASK();
38433840

3841+
/* This must never be called from inside a critical section. */
3842+
configASSERT( portGET_CRITICAL_NESTING_COUNT() == 0 );
3843+
38443844
/* portSOFRWARE_BARRIER() is only implemented for emulated/simulated ports that
38453845
* do not otherwise exhibit real time behaviour. */
38463846
portSOFTWARE_BARRIER();

0 commit comments

Comments
 (0)