mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-20 01:58:32 -04:00
feat(freertos-smp): Light Weight Preemption Disable Locks
This commit is contained in:
parent
ec3c41e444
commit
40a991d8eb
4 changed files with 223 additions and 22 deletions
|
@ -883,14 +883,29 @@
|
|||
#if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) )
|
||||
static BaseType_t prvUnlockEventGroupForTasks( EventGroup_t * pxEventBits )
|
||||
{
|
||||
BaseType_t xReturn = pdFALSE;
|
||||
|
||||
/* Release the previously held task spinlock */
|
||||
portRELEASE_SPINLOCK( portGET_CORE_ID(), &( pxEventBits->xTaskSpinlock ) );
|
||||
|
||||
/* Re-enable preemption */
|
||||
vTaskPreemptionEnable( NULL );
|
||||
|
||||
/* We assume that the task was preempted when preemption was enabled */
|
||||
return pdTRUE;
|
||||
/* Yield if preemption was re-enabled*/
|
||||
if( xTaskUnlockCanYield() == pdTRUE )
|
||||
{
|
||||
taskYIELD_WITHIN_API();
|
||||
|
||||
/* Return true as the task was preempted */
|
||||
xReturn = pdTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Return false as the task was not preempted */
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue