| 1896 | #if ( ( INCLUDE_eTaskGetState == 1 ) || ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_xTaskAbortDelay == 1 ) ) |
| 1897 | |
| 1898 | eTaskState eTaskGetState( TaskHandle_t xTask ) |
| 1899 | { |
| 1900 | eTaskState eReturn; |
| 1901 | List_t const * pxStateList, * pxDelayedList, * pxOverflowedDelayedList; |
| 1902 | const TCB_t * const pxTCB = xTask; |
| 1903 | |
| 1904 | configASSERT( pxTCB ); |
| 1905 | |
| 1906 | taskENTER_CRITICAL(); |
| 1907 | { |
| 1908 | pxStateList = listLIST_ITEM_CONTAINER( &( pxTCB->xStateListItem ) ); |
| 1909 | pxDelayedList = pxDelayedTaskList; |
| 1910 | pxOverflowedDelayedList = pxOverflowDelayedTaskList; |
| 1911 | } |
| 1912 | taskEXIT_CRITICAL(); |
| 1913 | |
| 1914 | if( ( pxStateList == pxDelayedList ) || ( pxStateList == pxOverflowedDelayedList ) ) |
| 1915 | { |
| 1916 | /* The task being queried is referenced from one of the Blocked |
| 1917 | * lists. */ |
| 1918 | eReturn = eBlocked; |
| 1919 | } |
| 1920 | |
| 1921 | #if ( INCLUDE_vTaskSuspend == 1 ) |
| 1922 | else if( pxStateList == &xSuspendedTaskList ) |
| 1923 | { |
| 1924 | /* The task being queried is referenced from the suspended |
| 1925 | * list. Is it genuinely suspended or is it blocked |
| 1926 | * indefinitely? */ |
| 1927 | if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) == NULL ) |
| 1928 | { |
| 1929 | #if ( configUSE_TASK_NOTIFICATIONS == 1 ) |
| 1930 | { |
| 1931 | BaseType_t x; |
| 1932 | |
| 1933 | /* The task does not appear on the event list item of |
| 1934 | * and of the RTOS objects, but could still be in the |
| 1935 | * blocked state if it is waiting on its notification |
| 1936 | * rather than waiting on an object. If not, is |
| 1937 | * suspended. */ |
| 1938 | eReturn = eSuspended; |
| 1939 | |
| 1940 | for( x = 0; x < configTASK_NOTIFICATION_ARRAY_ENTRIES; x++ ) |
| 1941 | { |
| 1942 | if( pxTCB->ucNotifyState[ x ] == taskWAITING_NOTIFICATION ) |
| 1943 | { |
| 1944 | eReturn = eBlocked; |
| 1945 | break; |
| 1946 | } |
| 1947 | } |
| 1948 | } |
| 1949 | #else /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ |
| 1950 | { |
| 1951 | eReturn = eSuspended; |
| 1952 | } |
| 1953 | #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ |
| 1954 | } |
| 1955 | else |
no outgoing calls
no test coverage detected