@@ -3087,8 +3087,8 @@ void vTaskPlaceOnEventList( List_t * const pxEventList,
3087
3087
{
3088
3088
configASSERT ( pxEventList );
3089
3089
3090
- /* THIS FUNCTION MUST BE CALLED WITH EITHER INTERRUPTS DISABLED OR THE
3091
- * SCHEDULER SUSPENDED AND THE QUEUE BEING ACCESSED LOCKED. */
3090
+ /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED AND THE QUEUE
3091
+ * BEING ACCESSED LOCKED. */
3092
3092
3093
3093
/* Place the event list item of the TCB in the appropriate event list.
3094
3094
* This is placed in the list in priority order so the highest priority task
@@ -4693,22 +4693,25 @@ TickType_t uxTaskResetEventItemValue( void )
4693
4693
configASSERT ( uxIndexToWait < configTASK_NOTIFICATION_ARRAY_ENTRIES );
4694
4694
4695
4695
taskENTER_CRITICAL ();
4696
+
4697
+ /* Only block if the notification count is not already non-zero. */
4698
+ if ( pxCurrentTCB -> ulNotifiedValue [ uxIndexToWait ] == 0UL )
4696
4699
{
4697
- /* Only block if the notification count is not already non-zero. */
4698
- if ( pxCurrentTCB -> ulNotifiedValue [ uxIndexToWait ] == 0UL )
4700
+ /* Mark this task as waiting for a notification. */
4701
+ pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] = taskWAITING_NOTIFICATION ;
4702
+
4703
+ if ( xTicksToWait > ( TickType_t ) 0 )
4699
4704
{
4700
- /* Mark this task as waiting for a notification. */
4701
- pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] = taskWAITING_NOTIFICATION ;
4705
+ traceTASK_NOTIFY_TAKE_BLOCK ( uxIndexToWait );
4702
4706
4703
- if ( xTicksToWait > ( TickType_t ) 0 )
4704
- {
4705
- prvAddCurrentTaskToDelayedList ( xTicksToWait , pdTRUE );
4706
- traceTASK_NOTIFY_TAKE_BLOCK ( uxIndexToWait );
4707
+ /* Suspend the scheduler before enabling interrupts. */
4708
+ vTaskSuspendAll ();
4709
+ taskEXIT_CRITICAL ();
4710
+
4711
+ prvAddCurrentTaskToDelayedList ( xTicksToWait , pdTRUE );
4707
4712
4708
- /* All ports are written to allow a yield in a critical
4709
- * section (some will yield immediately, others wait until the
4710
- * critical section exits) - but it is not something that
4711
- * application code should ever do. */
4713
+ if ( xTaskResumeAll () == pdFALSE )
4714
+ {
4712
4715
portYIELD_WITHIN_API ();
4713
4716
}
4714
4717
else
@@ -4718,10 +4721,13 @@ TickType_t uxTaskResetEventItemValue( void )
4718
4721
}
4719
4722
else
4720
4723
{
4721
- mtCOVERAGE_TEST_MARKER ();
4724
+ taskEXIT_CRITICAL ();
4722
4725
}
4723
4726
}
4724
- taskEXIT_CRITICAL ();
4727
+ else
4728
+ {
4729
+ taskEXIT_CRITICAL ();
4730
+ }
4725
4731
4726
4732
taskENTER_CRITICAL ();
4727
4733
{
@@ -4767,27 +4773,30 @@ TickType_t uxTaskResetEventItemValue( void )
4767
4773
configASSERT ( uxIndexToWait < configTASK_NOTIFICATION_ARRAY_ENTRIES );
4768
4774
4769
4775
taskENTER_CRITICAL ();
4776
+
4777
+ /* Only block if a notification is not already pending. */
4778
+ if ( pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] != taskNOTIFICATION_RECEIVED )
4770
4779
{
4771
- /* Only block if a notification is not already pending. */
4772
- if ( pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] != taskNOTIFICATION_RECEIVED )
4780
+ /* Clear bits in the task's notification value as bits may get
4781
+ * set by the notifying task or interrupt. This can be used to
4782
+ * clear the value to zero. */
4783
+ pxCurrentTCB -> ulNotifiedValue [ uxIndexToWait ] &= ~ulBitsToClearOnEntry ;
4784
+
4785
+ /* Mark this task as waiting for a notification. */
4786
+ pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] = taskWAITING_NOTIFICATION ;
4787
+
4788
+ if ( xTicksToWait > ( TickType_t ) 0 )
4773
4789
{
4774
- /* Clear bits in the task's notification value as bits may get
4775
- * set by the notifying task or interrupt. This can be used to
4776
- * clear the value to zero. */
4777
- pxCurrentTCB -> ulNotifiedValue [ uxIndexToWait ] &= ~ulBitsToClearOnEntry ;
4790
+ traceTASK_NOTIFY_WAIT_BLOCK ( uxIndexToWait );
4778
4791
4779
- /* Mark this task as waiting for a notification. */
4780
- pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] = taskWAITING_NOTIFICATION ;
4792
+ /* Suspend the scheduler before enabling interrupts. */
4793
+ vTaskSuspendAll ();
4794
+ taskEXIT_CRITICAL ();
4781
4795
4782
- if ( xTicksToWait > ( TickType_t ) 0 )
4783
- {
4784
- prvAddCurrentTaskToDelayedList ( xTicksToWait , pdTRUE );
4785
- traceTASK_NOTIFY_WAIT_BLOCK ( uxIndexToWait );
4796
+ prvAddCurrentTaskToDelayedList ( xTicksToWait , pdTRUE );
4786
4797
4787
- /* All ports are written to allow a yield in a critical
4788
- * section (some will yield immediately, others wait until the
4789
- * critical section exits) - but it is not something that
4790
- * application code should ever do. */
4798
+ if ( xTaskResumeAll () == pdFALSE )
4799
+ {
4791
4800
portYIELD_WITHIN_API ();
4792
4801
}
4793
4802
else
@@ -4797,10 +4806,13 @@ TickType_t uxTaskResetEventItemValue( void )
4797
4806
}
4798
4807
else
4799
4808
{
4800
- mtCOVERAGE_TEST_MARKER ();
4809
+ taskEXIT_CRITICAL ();
4801
4810
}
4802
4811
}
4803
- taskEXIT_CRITICAL ();
4812
+ else
4813
+ {
4814
+ taskEXIT_CRITICAL ();
4815
+ }
4804
4816
4805
4817
taskENTER_CRITICAL ();
4806
4818
{
0 commit comments