Go to the source code of this file.
Functions | |
void | vCreateSuicidalTasks (unsigned portBASE_TYPE uxPriority) |
portBASE_TYPE | xIsCreateTaskStillRunning (void) |
void vCreateSuicidalTasks | ( | unsigned portBASE_TYPE | uxPriority | ) |
Definition at line 125 of file death.c.
References deathSTACK_SIZE, portBASE_TYPE, pvPortMalloc(), uxTaskGetNumberOfTasks(), uxTasksRunningAtStart, and xTaskCreate.
Referenced by vErrorChecks().
00126 { 00127 unsigned portBASE_TYPE *puxPriority; 00128 00129 /* Create the Creator tasks - passing in as a parameter the priority at which 00130 the suicidal tasks should be created. */ 00131 puxPriority = ( unsigned portBASE_TYPE * ) pvPortMalloc( sizeof( unsigned portBASE_TYPE ) ); 00132 *puxPriority = uxPriority; 00133 00134 xTaskCreate( vCreateTasks, ( signed char * ) "CREATOR", deathSTACK_SIZE, ( void * ) puxPriority, uxPriority, NULL ); 00135 00136 /* Record the number of tasks that are running now so we know if any of the 00137 suicidal tasks have failed to be killed. */ 00138 uxTasksRunningAtStart = ( unsigned portBASE_TYPE ) uxTaskGetNumberOfTasks(); 00139 00140 /* FreeRTOS.org versions before V3.0 started the idle-task as the very 00141 first task. The idle task was then already included in uxTasksRunningAtStart. 00142 From FreeRTOS V3.0 on, the idle task is started when the scheduler is 00143 started. Therefore the idle task is not yet accounted for. We correct 00144 this by increasing uxTasksRunningAtStart by 1. */ 00145 uxTasksRunningAtStart++; 00146 }
portBASE_TYPE xIsCreateTaskStillRunning | ( | void | ) |
Definition at line 215 of file death.c.
References pdFALSE, pdTRUE, portBASE_TYPE, usCreationCount, uxMaxNumberOfExtraTasksRunning, uxTaskGetNumberOfTasks(), and uxTasksRunningAtStart.
Referenced by prvCheckOtherTasksAreStillRunning().
00216 { 00217 static unsigned short usLastCreationCount = 0xfff; 00218 portBASE_TYPE xReturn = pdTRUE; 00219 static unsigned portBASE_TYPE uxTasksRunningNow; 00220 00221 if( usLastCreationCount == usCreationCount ) 00222 { 00223 xReturn = pdFALSE; 00224 } 00225 else 00226 { 00227 usLastCreationCount = usCreationCount; 00228 } 00229 00230 uxTasksRunningNow = ( unsigned portBASE_TYPE ) uxTaskGetNumberOfTasks(); 00231 00232 if( uxTasksRunningNow < uxTasksRunningAtStart ) 00233 { 00234 xReturn = pdFALSE; 00235 } 00236 else if( ( uxTasksRunningNow - uxTasksRunningAtStart ) > uxMaxNumberOfExtraTasksRunning ) 00237 { 00238 xReturn = pdFALSE; 00239 } 00240 else 00241 { 00242 /* Everything is okay. */ 00243 } 00244 00245 return xReturn; 00246 }