From: richardbarry Date: Tue, 21 Sep 2010 21:10:41 +0000 (+0000) Subject: When creating a task - move where the task handle is assigned to the function paramet... X-Git-Tag: V6.1.0~20 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ac565d4fc3997c660db7c41a808968a7983d89f2;p=freertos 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. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1115 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/tasks.c b/Source/tasks.c index ddbddaa80..91e856724 100644 --- a/Source/tasks.c +++ b/Source/tasks.c @@ -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