| 2325 | #if ( INCLUDE_vTaskSuspend == 1 ) |
| 2326 | |
| 2327 | void vTaskSuspend( TaskHandle_t xTaskToSuspend ) |
| 2328 | { |
| 2329 | TCB_t * pxTCB; |
| 2330 | TaskRunning_t xTaskRunningOnCore; |
| 2331 | |
| 2332 | taskENTER_CRITICAL(); |
| 2333 | { |
| 2334 | /* If null is passed in here then it is the running task that is |
| 2335 | * being suspended. */ |
| 2336 | pxTCB = prvGetTCBFromHandle( xTaskToSuspend ); |
| 2337 | |
| 2338 | traceTASK_SUSPEND( pxTCB ); |
| 2339 | |
| 2340 | xTaskRunningOnCore = pxTCB->xTaskRunState; |
| 2341 | |
| 2342 | /* Remove task from the ready/delayed list and place in the |
| 2343 | * suspended list. */ |
| 2344 | if( uxListRemove( &( pxTCB->xStateListItem ) ) == ( UBaseType_t ) 0 ) |
| 2345 | { |
| 2346 | taskRESET_READY_PRIORITY( pxTCB->uxPriority ); |
| 2347 | } |
| 2348 | else |
| 2349 | { |
| 2350 | mtCOVERAGE_TEST_MARKER(); |
| 2351 | } |
| 2352 | |
| 2353 | /* Is the task waiting on an event also? */ |
| 2354 | if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL ) |
| 2355 | { |
| 2356 | ( void ) uxListRemove( &( pxTCB->xEventListItem ) ); |
| 2357 | } |
| 2358 | else |
| 2359 | { |
| 2360 | mtCOVERAGE_TEST_MARKER(); |
| 2361 | } |
| 2362 | |
| 2363 | vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xStateListItem ) ); |
| 2364 | |
| 2365 | #if ( configUSE_TASK_NOTIFICATIONS == 1 ) |
| 2366 | { |
| 2367 | BaseType_t x; |
| 2368 | |
| 2369 | for( x = 0; x < configTASK_NOTIFICATION_ARRAY_ENTRIES; x++ ) |
| 2370 | { |
| 2371 | if( pxTCB->ucNotifyState[ x ] == taskWAITING_NOTIFICATION ) |
| 2372 | { |
| 2373 | /* The task was blocked to wait for a notification, but is |
| 2374 | * now suspended, so no notification was received. */ |
| 2375 | pxTCB->ucNotifyState[ x ] = taskNOT_WAITING_NOTIFICATION; |
| 2376 | } |
| 2377 | } |
| 2378 | } |
| 2379 | #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ |
| 2380 | |
| 2381 | if( xSchedulerRunning != pdFALSE ) |
| 2382 | { |
| 2383 | /* Reset the next expected unblock time in case it referred to the |
| 2384 | * task that is now in the Suspended state. */ |
no test coverage detected