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:
Richard Barry 2010-09-21 21:10:41 +00:00
parent 1ec24e1d46
commit f052e7c00f

View File

@ -447,6 +447,14 @@ tskTCB * pxNewTCB;
}
#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
ready list, so must make sure no interrupts occur. */
portENTER_CRITICAL();
@ -506,14 +514,6 @@ tskTCB * pxNewTCB;
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 the created task is of a higher priority than the current task