diff options
| author | Frédéric Desbiens <[email protected]> | 2026-10-02 10:42:44 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-10-02 10:42:44 -0400 |
| commit | 93387b0a60382a29579bbad5045c68328e3751df (patch) | |
| tree | 42be790d602cb76f55090e5a7c418df7ea2b3428 /common/src/tx_thread_reset.c | |
| parent | 44d7c95c582d415c4ad84527180b29c93c3bf664 (diff) | |
| parent | 28281cd5647d4671236ca08d19bd18ed15b2265a (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_reset.c')
| -rw-r--r-- | common/src/tx_thread_reset.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/common/src/tx_thread_reset.c b/common/src/tx_thread_reset.c index da56daf5..8e59f1e7 100644 --- a/common/src/tx_thread_reset.c +++ b/common/src/tx_thread_reset.c @@ -9,6 +9,8 @@ * SPDX-License-Identifier: MIT **************************************************************************/ +// Portions of this file were generated with AI assistance. + /**************************************************************************/ /**************************************************************************/ @@ -104,6 +106,28 @@ UINT status; status = TX_NOT_DONE; } } + + /* The state is terminal, but a terminal state on its own is not authorization + to rebuild the stack and move the thread back to TX_SUSPENDED. Both paths + that produce one -- thread completion in _tx_thread_shell_entry and thread + termination in _tx_thread_terminate -- publish TX_COMPLETED or + TX_TERMINATED, and then run this thread's exit notification callback, before + the thread has been detached from the ready list. The suspending flag is + set for exactly that interval. Resetting inside it would also defeat the + protection _tx_thread_system_resume relies on, which refuses to cancel a + suspension only while the state is still terminal. */ + if (status == TX_SUCCESS) + { + + /* Is the completion or termination transition still in progress? */ + if (thread_ptr -> tx_thread_suspending == TX_TRUE) + { + + /* Yes, refuse the reset. The condition is transient: the caller may + retry once the transition has finished. */ + status = TX_NOT_DONE; + } + } } /* Is the request valid? */ |
