summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author陈泽堂 <[email protected]>2026-11-03 10:53:51 +0800
committerGitHub <[email protected]>2026-11-03 10:53:51 +0800
commit50693c33a44188d47f73198312a3d4427d08bf89 (patch)
treeb8f2989ef2ac1bd43a970cf0a528437a50b76f76 /src
parente0aa4cecafaa1e484d9013f315c70f3ef27e79a1 (diff)
fix[utest]: reset finish flags in the mailbox testcase so it can run twice #11963
Diffstat (limited to 'src')
-rw-r--r--src/utest/mailbox_tc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utest/mailbox_tc.c b/src/utest/mailbox_tc.c
index b51ee6e515..6d7ce13287 100644
--- a/src/utest/mailbox_tc.c
+++ b/src/utest/mailbox_tc.c
@@ -389,6 +389,17 @@ static void test_dynamic_mailbox_send_recv(void)
static rt_err_t utest_tc_init(void)
{
+ /* This testcase may be run more than once in a single boot. The finish
+ * flags are set by the worker threads and read by the test body, so they
+ * must be cleared before every run. Otherwise the second run would skip
+ * the wait loop, detach/delete the mailbox while the worker threads are
+ * still blocked in rt_mb_recv(), and those threads would then use an
+ * already detached mailbox. */
+ static_mb_recv_thread_finish = 0;
+ static_mb_send_thread_finish = 0;
+ dynamic_mb_recv_thread_finish = 0;
+ dynamic_mb_send_thread_finish = 0;
+
return RT_EOK;
}