summaryrefslogtreecommitdiff
path: root/common_smp/src
diff options
context:
space:
mode:
authorYuxin Zhou <[email protected]>2022-04-20 05:07:02 +0000
committerYuxin Zhou <[email protected]>2022-04-20 05:07:02 +0000
commitcef9cb22a5e2b9bca56074c5e627225ec0dd3d73 (patch)
treeace896ab3613348e16eef2a543affa2c984ee6ea /common_smp/src
parentf851772ce02633f62d2fb4d043766ea54268684f (diff)
Release 6.1.11
Diffstat (limited to 'common_smp/src')
-rw-r--r--common_smp/src/tx_event_flags_get.c16
-rw-r--r--common_smp/src/tx_event_flags_set.c21
-rw-r--r--common_smp/src/tx_thread_system_suspend.c22
3 files changed, 39 insertions, 20 deletions
diff --git a/common_smp/src/tx_event_flags_get.c b/common_smp/src/tx_event_flags_get.c
index 1e79a4cd..aba42c6b 100644
--- a/common_smp/src/tx_event_flags_get.c
+++ b/common_smp/src/tx_event_flags_get.c
@@ -36,7 +36,7 @@
/* FUNCTION RELEASE */
/* */
/* _tx_event_flags_get PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -73,9 +73,12 @@
/* */
/* DATE NAME DESCRIPTION */
/* */
-/* 05-19-2020 William E. Lamie Initial Version 6.0 */
-/* 09-30-2020 Yuxin Zhou Modified comment(s), */
+/* 05-19-2020 William E. Lamie Initial Version 6.0 */
+/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Scott Larson Modified comment(s), */
+/* handle 0 flags case, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _tx_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
@@ -276,11 +279,12 @@ UINT interrupted_set_request;
if (wait_option != TX_NO_WAIT)
{
- /* Determine if the preempt disable flag is non-zero. */
- if (_tx_thread_preempt_disable != ((UINT) 0))
+ /* Determine if the preempt disable flag is non-zero OR the requested events is 0. */
+ if ((_tx_thread_preempt_disable != ((UINT) 0)) || (requested_flags == (UINT) 0))
{
- /* Suspension is not allowed if the preempt disable flag is non-zero at this point, return error completion. */
+ /* Suspension is not allowed if the preempt disable flag is non-zero at this point,
+ or if requested_flags is 0, return error completion. */
status = TX_NO_EVENTS;
}
else
diff --git a/common_smp/src/tx_event_flags_set.c b/common_smp/src/tx_event_flags_set.c
index 9228f4cd..da0ff553 100644
--- a/common_smp/src/tx_event_flags_set.c
+++ b/common_smp/src/tx_event_flags_set.c
@@ -36,7 +36,7 @@
/* FUNCTION RELEASE */
/* */
/* _tx_event_flags_set PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -72,9 +72,13 @@
/* */
/* DATE NAME DESCRIPTION */
/* */
-/* 05-19-2020 William E. Lamie Initial Version 6.0 */
-/* 09-30-2020 Yuxin Zhou Modified comment(s), */
+/* 05-19-2020 William E. Lamie Initial Version 6.0 */
+/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 William E. Lamie Modified comment(s), and */
+/* added corrected preemption */
+/* check logic, resulting in */
+/* version 6.1.11 */
/* */
/**************************************************************************/
UINT _tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, UINT set_option)
@@ -264,9 +268,6 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
/* Yes, resume the thread and apply any event flag
clearing. */
- /* Set the preempt check flag. */
- preempt_check = TX_TRUE;
-
/* Return the actual event flags that satisfied the request. */
suspend_info_ptr = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info);
*suspend_info_ptr = current_event_flags;
@@ -336,6 +337,11 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
/* Disable preemption while we process the suspended list. */
_tx_thread_preempt_disable++;
+ /* Since we have temporarily disabled preemption globally, set the preempt
+ check flag to check for any preemption condition - including from
+ unrelated ISR processing. */
+ preempt_check = TX_TRUE;
+
/* Loop to examine all of the suspended threads. */
do
{
@@ -419,9 +425,6 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
/* Yes, this request can be handled now. */
- /* Set the preempt check flag. */
- preempt_check = TX_TRUE;
-
/* Determine if the thread is still suspended on the event flag group. If not, a wait
abort must have been done from an ISR. */
if (thread_ptr -> tx_thread_state == TX_EVENT_FLAG)
diff --git a/common_smp/src/tx_thread_system_suspend.c b/common_smp/src/tx_thread_system_suspend.c
index 8838d98e..a76a00d4 100644
--- a/common_smp/src/tx_thread_system_suspend.c
+++ b/common_smp/src/tx_thread_system_suspend.c
@@ -38,7 +38,7 @@
/* FUNCTION RELEASE */
/* */
/* _tx_thread_system_suspend PORTABLE SMP */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -87,7 +87,10 @@
/* */
/* DATE NAME DESCRIPTION */
/* */
-/* 09-30-2020 William E. Lamie Initial Version 6.1 */
+/* 09-30-2020 William E. Lamie Initial Version 6.1 */
+/* 04-25-2022 Scott Larson Modified comments and fixed */
+/* loop to find next thread, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _tx_thread_system_suspend(TX_THREAD *thread_ptr)
@@ -667,9 +670,18 @@ UINT processing_complete;
/* Calculate the possible complex path. */
complex_path_possible = possible_cores & available_cores;
+ /* Check if we need to loop to find the next highest priority thread. */
+ if (next_priority == TX_MAX_PRIORITIES)
+ {
+ loop_finished = TX_TRUE;
+ }
+ else
+ {
+ loop_finished = TX_FALSE;
+ }
+
/* Loop to find the next highest priority ready thread that is allowed to run on this core. */
- loop_finished = TX_FALSE;
- do
+ while (loop_finished == TX_FALSE)
{
/* Determine if there is a thread to examine. */
@@ -814,7 +826,7 @@ UINT processing_complete;
}
}
}
- } while (loop_finished == TX_FALSE);
+ }
#ifdef TX_THREAD_SMP_INTER_CORE_INTERRUPT