crash in Semaphore enqueuing test
Posted: Sun Aug 15, 2021 3:10 pm
I recently upgraded a project from 20.3.x to 21.6.x. The semaphore enqueuing test (7.2) consistently crashed when run with other code in my project. When I turned off CH_CFG_USE_SEMAPHORES_PRIORITY the problem went away. Looking at the code, I suspect this patch is the problem. With this patch, the test now passes.
Thanks!
Code: Select all
diff --git a/os/rt/src/chsem.c b/os/rt/src/chsem.c
index 51073fe89..7fae1779b 100644
--- a/os/rt/src/chsem.c
+++ b/os/rt/src/chsem.c
@@ -76,7 +76,7 @@
/*===========================================================================*/
#if CH_CFG_USE_SEMAPHORES_PRIORITY == TRUE
-#define sem_insert(qp, tp) ch_sch_prio_insert(&tp->hdr.queue, qp)
+#define sem_insert(qp, tp) ch_sch_prio_insert(qp, &tp->hdr.queue)
#else
#define sem_insert(qp, tp) ch_queue_insert(qp, &tp->hdr.queue)
#endifThanks!