mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 09:38:32 -04:00
refactor: change methods ENTER|EXIT critical (#1140)
refactor: change methods ENTER|EXIT critical The read and write of BaseType_t are atomic for a number of ports and therefore, do not require taskENTER_CRITICAL/taskEXIT_CRITICAL. This PR introduces portBASE_TYPE_ENTER_CRITICAL and portBASE_TYPE_EXIT_CRITICAL which default to taskENTER_CRITICAL and taskEXIT_CRITICAL. The APIs that read/write BaseType_t are updated to use these new macros. The next change would to be to define portBASE_TYPE_ENTER_CRITICAL and portBASE_TYPE_EXIT_CRITICAL to nothing for ports where BaseType_t read and write are atomic. Signed-off-by: guilherme giacomo simoes <trintaeoitogc@gmail.com>
This commit is contained in:
parent
1cb8042961
commit
e81ad46b0e
6 changed files with 24 additions and 16 deletions
12
tasks.c
12
tasks.c
|
@ -2623,14 +2623,14 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
|
||||
traceENTER_uxTaskPriorityGet( xTask );
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
portBASE_TYPE_ENTER_CRITICAL();
|
||||
{
|
||||
/* If null is passed in here then it is the priority of the task
|
||||
* that called uxTaskPriorityGet() that is being queried. */
|
||||
pxTCB = prvGetTCBFromHandle( xTask );
|
||||
uxReturn = pxTCB->uxPriority;
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
portBASE_TYPE_EXIT_CRITICAL();
|
||||
|
||||
traceRETURN_uxTaskPriorityGet( uxReturn );
|
||||
|
||||
|
@ -2697,14 +2697,14 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
|
||||
traceENTER_uxTaskBasePriorityGet( xTask );
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
portBASE_TYPE_ENTER_CRITICAL();
|
||||
{
|
||||
/* If null is passed in here then it is the base priority of the task
|
||||
* that called uxTaskBasePriorityGet() that is being queried. */
|
||||
pxTCB = prvGetTCBFromHandle( xTask );
|
||||
uxReturn = pxTCB->uxBasePriority;
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
portBASE_TYPE_EXIT_CRITICAL();
|
||||
|
||||
traceRETURN_uxTaskBasePriorityGet( uxReturn );
|
||||
|
||||
|
@ -3040,12 +3040,12 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
|
||||
traceENTER_vTaskCoreAffinityGet( xTask );
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
portBASE_TYPE_ENTER_CRITICAL();
|
||||
{
|
||||
pxTCB = prvGetTCBFromHandle( xTask );
|
||||
uxCoreAffinityMask = pxTCB->uxCoreAffinityMask;
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
portBASE_TYPE_EXIT_CRITICAL();
|
||||
|
||||
traceRETURN_vTaskCoreAffinityGet( uxCoreAffinityMask );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue