forked from epagris/FreeRTOS-Kernel
		
	Distinguish waiting for notify status from suspend status (#865)
* Fix prvTaskIsTaskSuspended. Just like eTaskGetState, distinguish waiting for notify from suspend. * Fix vTaskGetInfo. Just like eTaskGetState, distinguish block state (waiting on notification) from suspend state. * Add missing definition of variable x. * Fix formatting syntax. --------- Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> Co-authored-by: Tony Josi <tonyjosi@amazon.com>
This commit is contained in:
		
							parent
							
								
									8ede50cafd
								
							
						
					
					
						commit
						0640b2e486
					
				
							
								
								
									
										46
									
								
								tasks.c
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								tasks.c
									
									
									
									
									
								
							@ -3284,10 +3284,34 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
 | 
			
		||||
            if( listIS_CONTAINED_WITHIN( &xPendingReadyList, &( pxTCB->xEventListItem ) ) == pdFALSE )
 | 
			
		||||
            {
 | 
			
		||||
                /* Is it in the suspended list because it is in the Suspended
 | 
			
		||||
                 * state, or because is is blocked with no timeout? */
 | 
			
		||||
                 * state, or because it is blocked with no timeout? */
 | 
			
		||||
                if( listIS_CONTAINED_WITHIN( NULL, &( pxTCB->xEventListItem ) ) != pdFALSE ) /*lint !e961.  The cast is only redundant when NULL is used. */
 | 
			
		||||
                {
 | 
			
		||||
                    xReturn = pdTRUE;
 | 
			
		||||
                    #if ( configUSE_TASK_NOTIFICATIONS == 1 )
 | 
			
		||||
                    {
 | 
			
		||||
                        BaseType_t x;
 | 
			
		||||
 | 
			
		||||
                        /* The task does not appear on the event list item of
 | 
			
		||||
                         * and of the RTOS objects, but could still be in the
 | 
			
		||||
                         * blocked state if it is waiting on its notification
 | 
			
		||||
                         * rather than waiting on an object.  If not, is
 | 
			
		||||
                         * suspended. */
 | 
			
		||||
                        xReturn = pdTRUE;
 | 
			
		||||
 | 
			
		||||
                        for( x = ( BaseType_t ) 0; x < ( BaseType_t ) configTASK_NOTIFICATION_ARRAY_ENTRIES; x++ )
 | 
			
		||||
                        {
 | 
			
		||||
                            if( pxTCB->ucNotifyState[ x ] == taskWAITING_NOTIFICATION )
 | 
			
		||||
                            {
 | 
			
		||||
                                xReturn = pdFALSE;
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    #else /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
 | 
			
		||||
                    {
 | 
			
		||||
                        xReturn = pdTRUE;
 | 
			
		||||
                    }
 | 
			
		||||
                    #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
@ -6131,6 +6155,24 @@ static void prvCheckTasksWaitingTermination( void )
 | 
			
		||||
                            {
 | 
			
		||||
                                pxTaskStatus->eCurrentState = eBlocked;
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                BaseType_t x;
 | 
			
		||||
 | 
			
		||||
                                /* The task does not appear on the event list item of
 | 
			
		||||
                                 * and of the RTOS objects, but could still be in the
 | 
			
		||||
                                 * blocked state if it is waiting on its notification
 | 
			
		||||
                                 * rather than waiting on an object.  If not, is
 | 
			
		||||
                                 * suspended. */
 | 
			
		||||
                                for( x = ( BaseType_t ) 0; x < ( BaseType_t ) configTASK_NOTIFICATION_ARRAY_ENTRIES; x++ )
 | 
			
		||||
                                {
 | 
			
		||||
                                    if( pxTCB->ucNotifyState[ x ] == taskWAITING_NOTIFICATION )
 | 
			
		||||
                                    {
 | 
			
		||||
                                        pxTaskStatus->eCurrentState = eBlocked;
 | 
			
		||||
                                        break;
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        ( void ) xTaskResumeAll();
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user