aboutsummaryrefslogtreecommitdiffstats
path: root/src/chsem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chsem.c')
-rw-r--r--src/chsem.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/chsem.c b/src/chsem.c
index 6953fb846..14b8567ad 100644
--- a/src/chsem.c
+++ b/src/chsem.c
@@ -174,8 +174,13 @@ void chSemSignal(Semaphore *sp) {
*/
void chSemSignalI(Semaphore *sp) {
- if (sp->s_cnt++ < 0)
- chSchReadyI(fifo_remove(&sp->s_queue))->p_rdymsg = RDY_OK;
+ if (sp->s_cnt++ < 0) {
+ /* NOTE: It is done this way in order to allow a tail call on
+ chSchReadyI().*/
+ Thread *tp = fifo_remove(&sp->s_queue);
+ tp->p_rdymsg = RDY_OK;
+ chSchReadyI(tp);
+ }
}
#ifdef CH_USE_SEMSW