diff options
| author | Frédéric Desbiens <[email protected]> | 2026-09-10 12:06:54 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-09-10 12:06:54 -0400 |
| commit | c0aa4dbe2932bb12bb69545ff5d4945e0b019ffe (patch) | |
| tree | 55cfc6ce0d35d3c0d5e635a33c770c2e3ee314b7 | |
| parent | 70741198e9f6831acf52257913d1bb9c7a5a2720 (diff) | |
Initialized the suspend status before the non-interruptable suspend in tx_thread_sleep, so a sleep no longer returns a stale error left over from an earlier timed-out suspension (#725)
When TX_NOT_INTERRUPTABLE is defined, _tx_thread_sleep did not set
tx_thread_suspend_status to TX_SUCCESS before calling
_tx_thread_system_ni_suspend. The interruptable path always did.
Nothing else writes that field on behalf of a sleeping thread:
_tx_thread_timeout resumes a TX_SLEEP thread directly and there is no
suspend cleanup routine for sleep. The value therefore survived from
whatever suspension the thread performed last, and tx_thread_sleep
returned it. A tx_semaphore_get that timed out with TX_NO_INSTANCE
would be followed by a tx_thread_sleep that also returned
TX_NO_INSTANCE after sleeping correctly.
The same change is applied to the SMP copy, which is identical.
Assisted-by: Copilot (Opus 5) <[email protected]>
| -rw-r--r-- | common/src/tx_thread_sleep.c | 4 | ||||
| -rw-r--r-- | common_smp/src/tx_thread_sleep.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/common/src/tx_thread_sleep.c b/common/src/tx_thread_sleep.c index fd986a0b..fb04f337 100644 --- a/common/src/tx_thread_sleep.c +++ b/common/src/tx_thread_sleep.c @@ -9,6 +9,7 @@ * SPDX-License-Identifier: MIT **************************************************************************/ +// Some portions generated by Copilot (Opus 5). /**************************************************************************/ /**************************************************************************/ @@ -155,6 +156,9 @@ TX_THREAD *thread_ptr; #ifdef TX_NOT_INTERRUPTABLE + /* Initialize the status to successful. */ + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + /* Call actual non-interruptable thread suspension routine. */ _tx_thread_system_ni_suspend(thread_ptr, timer_ticks); diff --git a/common_smp/src/tx_thread_sleep.c b/common_smp/src/tx_thread_sleep.c index fd986a0b..fb04f337 100644 --- a/common_smp/src/tx_thread_sleep.c +++ b/common_smp/src/tx_thread_sleep.c @@ -9,6 +9,7 @@ * SPDX-License-Identifier: MIT **************************************************************************/ +// Some portions generated by Copilot (Opus 5). /**************************************************************************/ /**************************************************************************/ @@ -155,6 +156,9 @@ TX_THREAD *thread_ptr; #ifdef TX_NOT_INTERRUPTABLE + /* Initialize the status to successful. */ + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + /* Call actual non-interruptable thread suspension routine. */ _tx_thread_system_ni_suspend(thread_ptr, timer_ticks); |
