mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-07 05:34:59 -05:00
Fix vTaskSuspendAll assert for critical nesting count
* Accessing the current task's TCB should be performed with interrupt disabled to ensure atomicity.
This commit is contained in:
parent
8afb3a5b82
commit
b3628902a9
1 changed files with 3 additions and 3 deletions
6
tasks.c
6
tasks.c
|
|
@ -3830,9 +3830,6 @@ void vTaskSuspendAll( void )
|
||||||
|
|
||||||
if( xSchedulerRunning != pdFALSE )
|
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.
|
/* 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
|
* We must disable interrupts before we grab the locks in the event that this task is
|
||||||
* interrupted and switches context before incrementing uxSchedulerSuspended.
|
* interrupted and switches context before incrementing uxSchedulerSuspended.
|
||||||
|
|
@ -3840,6 +3837,9 @@ void vTaskSuspendAll( void )
|
||||||
* uxSchedulerSuspended since that will prevent context switches. */
|
* uxSchedulerSuspended since that will prevent context switches. */
|
||||||
ulState = portSET_INTERRUPT_MASK();
|
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
|
/* portSOFRWARE_BARRIER() is only implemented for emulated/simulated ports that
|
||||||
* do not otherwise exhibit real time behaviour. */
|
* do not otherwise exhibit real time behaviour. */
|
||||||
portSOFTWARE_BARRIER();
|
portSOFTWARE_BARRIER();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue