summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorari.liu <[email protected]>2026-08-21 11:16:10 +0800
committerRbb666 <[email protected]>2026-08-21 16:52:01 +0800
commitba79f69477686196da1aa1aca3792e8f6c4e3085 (patch)
tree4f1de264b2f2a123013cc757bd6bcad139158680 /src/thread.c
parent5ae08713c8b409aef8ba1d887c3f228566537909 (diff)
[kernel][ipc] Fix timeout wakeup ownership race
Keep thread timer ownership when timer stop races with an in-flight timeout callback, and consume IPC resources only after a waiter is resumed successfully. Complete ownership cleanup in the generic and RT-Smart channel timeout callbacks. Add deterministic scheduler and LWP regressions for Event, Semaphore, Mailbox, Message Queue, sender, and receiver paths.
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/thread.c b/src/thread.c
index 745e3f774f..0c4a645eac 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -162,6 +162,9 @@ static void _thread_timeout(void *parameter)
*/
RT_ASSERT(rt_sched_thread_is_suspended(thread));
+ /* The timeout callback now owns this thread timer. */
+ RT_SCHED_CTX(thread).sched_flag_ttmr_set = 0;
+
/* set error number */
thread->error = -RT_ETIMEOUT;