mirror of
				https://github.com/FreeRTOS/FreeRTOS-Kernel.git
				synced 2025-11-04 11:09:01 +01:00 
			
		
		
		
	Don't suspend scheduler if task already notified (#1190)
* Don't suspend scheduler if task already notified
This commit is contained in:
		
							parent
							
								
									9736947af2
								
							
						
					
					
						commit
						8f7f451c2a
					
				
							
								
								
									
										26
									
								
								tasks.c
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								tasks.c
									
									
									
									
									
								
							@ -7659,6 +7659,10 @@ TickType_t uxTaskResetEventItemValue( void )
 | 
			
		||||
 | 
			
		||||
        configASSERT( uxIndexToWaitOn < configTASK_NOTIFICATION_ARRAY_ENTRIES );
 | 
			
		||||
 | 
			
		||||
        /* If the notification count is zero, and if we are willing to wait for a
 | 
			
		||||
         * notification, then block the task and wait. */
 | 
			
		||||
        if( ( pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ] == 0U ) && ( xTicksToWait > ( TickType_t ) 0 ) )
 | 
			
		||||
        {
 | 
			
		||||
            /* We suspend the scheduler here as prvAddCurrentTaskToDelayedList is a
 | 
			
		||||
             * non-deterministic operation. */
 | 
			
		||||
            vTaskSuspendAll();
 | 
			
		||||
@ -7675,8 +7679,7 @@ TickType_t uxTaskResetEventItemValue( void )
 | 
			
		||||
                        /* Mark this task as waiting for a notification. */
 | 
			
		||||
                        pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] = taskWAITING_NOTIFICATION;
 | 
			
		||||
 | 
			
		||||
                    if( xTicksToWait > ( TickType_t ) 0 )
 | 
			
		||||
                    {
 | 
			
		||||
                        /* Arrange to wait for a notification. */
 | 
			
		||||
                        xShouldBlock = pdTRUE;
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
@ -7684,11 +7687,6 @@ TickType_t uxTaskResetEventItemValue( void )
 | 
			
		||||
                        mtCOVERAGE_TEST_MARKER();
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    mtCOVERAGE_TEST_MARKER();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
                taskEXIT_CRITICAL();
 | 
			
		||||
 | 
			
		||||
                /* We are now out of the critical section but the scheduler is still
 | 
			
		||||
@ -7715,6 +7713,7 @@ TickType_t uxTaskResetEventItemValue( void )
 | 
			
		||||
            {
 | 
			
		||||
                mtCOVERAGE_TEST_MARKER();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        taskENTER_CRITICAL();
 | 
			
		||||
        {
 | 
			
		||||
@ -7763,6 +7762,10 @@ TickType_t uxTaskResetEventItemValue( void )
 | 
			
		||||
 | 
			
		||||
        configASSERT( uxIndexToWaitOn < configTASK_NOTIFICATION_ARRAY_ENTRIES );
 | 
			
		||||
 | 
			
		||||
        /* If the task hasn't received a notification, and if we are willing to wait
 | 
			
		||||
         * for it, then block the task and wait. */
 | 
			
		||||
        if( ( pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] != taskNOTIFICATION_RECEIVED ) && ( xTicksToWait > ( TickType_t ) 0 ) )
 | 
			
		||||
        {
 | 
			
		||||
            /* We suspend the scheduler here as prvAddCurrentTaskToDelayedList is a
 | 
			
		||||
             * non-deterministic operation. */
 | 
			
		||||
            vTaskSuspendAll();
 | 
			
		||||
@ -7783,8 +7786,7 @@ TickType_t uxTaskResetEventItemValue( void )
 | 
			
		||||
                        /* Mark this task as waiting for a notification. */
 | 
			
		||||
                        pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] = taskWAITING_NOTIFICATION;
 | 
			
		||||
 | 
			
		||||
                    if( xTicksToWait > ( TickType_t ) 0 )
 | 
			
		||||
                    {
 | 
			
		||||
                        /* Arrange to wait for a notification. */
 | 
			
		||||
                        xShouldBlock = pdTRUE;
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
@ -7792,11 +7794,6 @@ TickType_t uxTaskResetEventItemValue( void )
 | 
			
		||||
                        mtCOVERAGE_TEST_MARKER();
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    mtCOVERAGE_TEST_MARKER();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
                taskEXIT_CRITICAL();
 | 
			
		||||
 | 
			
		||||
                /* We are now out of the critical section but the scheduler is still
 | 
			
		||||
@ -7823,6 +7820,7 @@ TickType_t uxTaskResetEventItemValue( void )
 | 
			
		||||
            {
 | 
			
		||||
                mtCOVERAGE_TEST_MARKER();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        taskENTER_CRITICAL();
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user