aboutsummaryrefslogtreecommitdiffstats
path: root/src/chschd.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-07-26 09:25:11 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-07-26 09:25:11 +0000
commit69f9642bf44e6e3de680b07a22a290b9219ab47d (patch)
tree260cffa032b2d796e8bbabfa172d6c0c50ffd2b4 /src/chschd.c
parent868866157762bc5ad7644fcaa45111ecf6ed1899 (diff)
downloadChibiOS-69f9642bf44e6e3de680b07a22a290b9219ab47d.tar.gz
ChibiOS-69f9642bf44e6e3de680b07a22a290b9219ab47d.tar.bz2
ChibiOS-69f9642bf44e6e3de680b07a22a290b9219ab47d.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@359 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chschd.c')
-rw-r--r--src/chschd.c9
1 files changed, 5 insertions, 4 deletions
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 */