Assert if prvCheckForRunStateChange is called in ISR (#779)

* Assert if prvCheckForRunStateChange is called in ISR
This commit is contained in:
chinglee-iot 2023-09-06 17:47:41 +08:00 committed by GitHub
parent 288d143357
commit 53229b1537
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

10
tasks.c
View file

@ -693,12 +693,9 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
UBaseType_t uxPrevCriticalNesting; UBaseType_t uxPrevCriticalNesting;
const TCB_t * pxThisTCB; const TCB_t * pxThisTCB;
/* This should be skipped if called from an ISR. If the task on the current /* This must only be called from within a task. */
* core is no longer running, then vTaskSwitchContext() probably should portASSERT_IF_IN_ISR();
* be run before returning, but we don't have a way to force that to happen
* from here. */
if( portCHECK_IF_IN_ISR() == pdFALSE )
{
/* This function is always called with interrupts disabled /* This function is always called with interrupts disabled
* so this is safe. */ * so this is safe. */
pxThisTCB = pxCurrentTCBs[ portGET_CORE_ID() ]; pxThisTCB = pxCurrentTCBs[ portGET_CORE_ID() ];
@ -751,7 +748,6 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
} }
} }
} }
}
#endif /* #if ( configNUMBER_OF_CORES > 1 ) */ #endif /* #if ( configNUMBER_OF_CORES > 1 ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/