From 69f9642bf44e6e3de680b07a22a290b9219ab47d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 26 Jul 2008 09:25:11 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@359 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chschd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/chschd.c') diff --git a/src/chschd.c b/src/chschd.c index c3e0fbaed..c97eea1e8 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -146,20 +146,21 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) { */ void chSchWakeupS(Thread *ntp, msg_t msg) { ntp->p_rdymsg = msg; - /* the woken thread has equal or lower priority than the running thread? */ if (ntp->p_prio <= currp->p_prio) - /* put the woken thread on the ready queue */ + /* the woken thread has equal or lower priority than the running thread */ chSchReadyI(ntp); - /* the woken thread has higher priority than the running thread */ else { - /* put the running thread on the ready queue */ + /* the woken thread has higher priority than the running thread and thus + * preempts the currently running thread. */ Thread *otp = currp; chSchReadyI(otp); + /* change the to-be-run thread to running state */ (currp = ntp)->p_state = PRCURR; #ifdef CH_USE_ROUNDROBIN rlist.r_preempt = CH_TIME_QUANTUM; #endif #ifdef CH_USE_TRACE + /* trace the context switch */ chDbgTrace(otp, ntp); #endif /* switch the thread context */ -- cgit v1.2.3