mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
When creating a task - move where the task handle is assigned to the function parameter from after the critical section. This allows the handle to be assigned to a global variable, and the global variable to be access by the task being created should the task being created execute immediately that the critical section is exited.
This commit is contained in:
parent
1ec24e1d46
commit
f052e7c00f
|
@ -447,6 +447,14 @@ tskTCB * pxNewTCB;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if( ( void * ) pxCreatedTask != NULL )
|
||||||
|
{
|
||||||
|
/* Pass the TCB out - in an anonymous way. The calling function/
|
||||||
|
task can use this as a handle to delete the task later if
|
||||||
|
required.*/
|
||||||
|
*pxCreatedTask = ( xTaskHandle ) pxNewTCB;
|
||||||
|
}
|
||||||
|
|
||||||
/* We are going to manipulate the task queues to add this task to a
|
/* We are going to manipulate the task queues to add this task to a
|
||||||
ready list, so must make sure no interrupts occur. */
|
ready list, so must make sure no interrupts occur. */
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
|
@ -506,14 +514,6 @@ tskTCB * pxNewTCB;
|
||||||
|
|
||||||
if( xReturn == pdPASS )
|
if( xReturn == pdPASS )
|
||||||
{
|
{
|
||||||
if( ( void * ) pxCreatedTask != NULL )
|
|
||||||
{
|
|
||||||
/* Pass the TCB out - in an anonymous way. The calling function/
|
|
||||||
task can use this as a handle to delete the task later if
|
|
||||||
required.*/
|
|
||||||
*pxCreatedTask = ( xTaskHandle ) pxNewTCB;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( xSchedulerRunning != pdFALSE )
|
if( xSchedulerRunning != pdFALSE )
|
||||||
{
|
{
|
||||||
/* If the created task is of a higher priority than the current task
|
/* If the created task is of a higher priority than the current task
|
||||||
|
|
Loading…
Reference in a new issue