summaryrefslogtreecommitdiff
path: root/common/src/tx_thread_shell_entry.c
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-10-02 10:42:44 -0400
committerGitHub <[email protected]>2026-10-02 10:42:44 -0400
commit93387b0a60382a29579bbad5045c68328e3751df (patch)
tree42be790d602cb76f55090e5a7c418df7ea2b3428 /common/src/tx_thread_shell_entry.c
parent44d7c95c582d415c4ad84527180b29c93c3bf664 (diff)
parent28281cd5647d4671236ca08d19bd18ed15b2265a (diff)
Merge pull request #783 from eclipse-threadx/devv6.5.2.202603_rel
Merged changes ahead of the v6.5.2.202603 release
Diffstat (limited to 'common/src/tx_thread_shell_entry.c')
-rw-r--r--common/src/tx_thread_shell_entry.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/common/src/tx_thread_shell_entry.c b/common/src/tx_thread_shell_entry.c
index 45fe9d6d..2a16a00b 100644
--- a/common/src/tx_thread_shell_entry.c
+++ b/common/src/tx_thread_shell_entry.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/**************************************************************************/
/**************************************************************************/
@@ -134,6 +136,17 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type);
#ifdef TX_NOT_INTERRUPTABLE
+ /* Set the suspending flag, so that the completion transition is marked as in
+ progress for the same interval it is marked in the interruptable
+ configuration below. Nothing in this configuration needs the flag to cancel
+ an interrupted suspension -- interrupts stay disabled through the whole
+ transition -- but the notification callback and the completion extension
+ below are application code, reached by a direct call, and interrupt lockout
+ does not stop either of them from calling a thread lifecycle service on this
+ same control block. The flag is what _tx_thread_delete and _tx_thread_reset
+ test in order to refuse one. */
+ thread_ptr -> tx_thread_suspending = TX_TRUE;
+
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
/* Determine if an application callback routine is specified. */
@@ -148,6 +161,15 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type);
/* Perform any additional activities for tool or user purpose. */
TX_THREAD_COMPLETED_EXTENSION(thread_ptr)
+ /* Clear the suspending flag. It has to be cleared here rather than after the
+ call below, because _tx_thread_system_ni_suspend returns to the scheduler for
+ a thread that is the current thread, which this one is, and so does not come
+ back. Clearing it afterwards would leave a normally completed thread marked
+ as transitioning for ever and therefore permanently undeletable. Clearing it
+ here loses nothing: everything from this point to the detachment runs with
+ interrupts disabled and calls no application code. */
+ thread_ptr -> tx_thread_suspending = TX_FALSE;
+
/* Call actual non-interruptable thread suspension routine. */
_tx_thread_system_ni_suspend(thread_ptr, ((ULONG) 0));