@@ -3137,8 +3137,8 @@ void vTaskPlaceOnEventList( List_t * const pxEventList,
3137
3137
{
3138
3138
configASSERT ( pxEventList );
3139
3139
3140
- /* THIS FUNCTION MUST BE CALLED WITH EITHER INTERRUPTS DISABLED OR THE
3141
- * SCHEDULER SUSPENDED AND THE QUEUE BEING ACCESSED LOCKED. */
3140
+ /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED AND THE QUEUE
3141
+ * BEING ACCESSED LOCKED. */
3142
3142
3143
3143
/* Place the event list item of the TCB in the appropriate event list.
3144
3144
* This is placed in the list in priority order so the highest priority task
@@ -4744,22 +4744,25 @@ TickType_t uxTaskResetEventItemValue( void )
4744
4744
configASSERT ( uxIndexToWait < configTASK_NOTIFICATION_ARRAY_ENTRIES );
4745
4745
4746
4746
taskENTER_CRITICAL ();
4747
+
4748
+ /* Only block if the notification count is not already non-zero. */
4749
+ if ( pxCurrentTCB -> ulNotifiedValue [ uxIndexToWait ] == 0UL )
4747
4750
{
4748
- /* Only block if the notification count is not already non-zero. */
4749
- if ( pxCurrentTCB -> ulNotifiedValue [ uxIndexToWait ] == 0UL )
4751
+ /* Mark this task as waiting for a notification. */
4752
+ pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] = taskWAITING_NOTIFICATION ;
4753
+
4754
+ if ( xTicksToWait > ( TickType_t ) 0 )
4750
4755
{
4751
- /* Mark this task as waiting for a notification. */
4752
- pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] = taskWAITING_NOTIFICATION ;
4756
+ traceTASK_NOTIFY_TAKE_BLOCK ( uxIndexToWait );
4753
4757
4754
- if ( xTicksToWait > ( TickType_t ) 0 )
4755
- {
4756
- prvAddCurrentTaskToDelayedList ( xTicksToWait , pdTRUE );
4757
- traceTASK_NOTIFY_TAKE_BLOCK ( uxIndexToWait );
4758
+ /* Suspend the scheduler before enabling interrupts. */
4759
+ vTaskSuspendAll ();
4760
+ taskEXIT_CRITICAL ();
4761
+
4762
+ prvAddCurrentTaskToDelayedList ( xTicksToWait , pdTRUE );
4758
4763
4759
- /* All ports are written to allow a yield in a critical
4760
- * section (some will yield immediately, others wait until the
4761
- * critical section exits) - but it is not something that
4762
- * application code should ever do. */
4764
+ if ( xTaskResumeAll () == pdFALSE )
4765
+ {
4763
4766
portYIELD_WITHIN_API ();
4764
4767
}
4765
4768
else
@@ -4769,10 +4772,13 @@ TickType_t uxTaskResetEventItemValue( void )
4769
4772
}
4770
4773
else
4771
4774
{
4772
- mtCOVERAGE_TEST_MARKER ();
4775
+ taskEXIT_CRITICAL ();
4773
4776
}
4774
4777
}
4775
- taskEXIT_CRITICAL ();
4778
+ else
4779
+ {
4780
+ taskEXIT_CRITICAL ();
4781
+ }
4776
4782
4777
4783
taskENTER_CRITICAL ();
4778
4784
{
@@ -4818,27 +4824,30 @@ TickType_t uxTaskResetEventItemValue( void )
4818
4824
configASSERT ( uxIndexToWait < configTASK_NOTIFICATION_ARRAY_ENTRIES );
4819
4825
4820
4826
taskENTER_CRITICAL ();
4827
+
4828
+ /* Only block if a notification is not already pending. */
4829
+ if ( pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] != taskNOTIFICATION_RECEIVED )
4821
4830
{
4822
- /* Only block if a notification is not already pending. */
4823
- if ( pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] != taskNOTIFICATION_RECEIVED )
4831
+ /* Clear bits in the task's notification value as bits may get
4832
+ * set by the notifying task or interrupt. This can be used to
4833
+ * clear the value to zero. */
4834
+ pxCurrentTCB -> ulNotifiedValue [ uxIndexToWait ] &= ~ulBitsToClearOnEntry ;
4835
+
4836
+ /* Mark this task as waiting for a notification. */
4837
+ pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] = taskWAITING_NOTIFICATION ;
4838
+
4839
+ if ( xTicksToWait > ( TickType_t ) 0 )
4824
4840
{
4825
- /* Clear bits in the task's notification value as bits may get
4826
- * set by the notifying task or interrupt. This can be used to
4827
- * clear the value to zero. */
4828
- pxCurrentTCB -> ulNotifiedValue [ uxIndexToWait ] &= ~ulBitsToClearOnEntry ;
4841
+ traceTASK_NOTIFY_WAIT_BLOCK ( uxIndexToWait );
4829
4842
4830
- /* Mark this task as waiting for a notification. */
4831
- pxCurrentTCB -> ucNotifyState [ uxIndexToWait ] = taskWAITING_NOTIFICATION ;
4843
+ /* Suspend the scheduler before enabling interrupts. */
4844
+ vTaskSuspendAll ();
4845
+ taskEXIT_CRITICAL ();
4832
4846
4833
- if ( xTicksToWait > ( TickType_t ) 0 )
4834
- {
4835
- prvAddCurrentTaskToDelayedList ( xTicksToWait , pdTRUE );
4836
- traceTASK_NOTIFY_WAIT_BLOCK ( uxIndexToWait );
4847
+ prvAddCurrentTaskToDelayedList ( xTicksToWait , pdTRUE );
4837
4848
4838
- /* All ports are written to allow a yield in a critical
4839
- * section (some will yield immediately, others wait until the
4840
- * critical section exits) - but it is not something that
4841
- * application code should ever do. */
4849
+ if ( xTaskResumeAll () == pdFALSE )
4850
+ {
4842
4851
portYIELD_WITHIN_API ();
4843
4852
}
4844
4853
else
@@ -4848,10 +4857,13 @@ TickType_t uxTaskResetEventItemValue( void )
4848
4857
}
4849
4858
else
4850
4859
{
4851
- mtCOVERAGE_TEST_MARKER ();
4860
+ taskEXIT_CRITICAL ();
4852
4861
}
4853
4862
}
4854
- taskEXIT_CRITICAL ();
4863
+ else
4864
+ {
4865
+ taskEXIT_CRITICAL ();
4866
+ }
4855
4867
4856
4868
taskENTER_CRITICAL ();
4857
4869
{
0 commit comments