From 79075f9e81d9d56be5da3bf6cdae56f4ace950de Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Mar 2010 12:48:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1755 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chschd.c | 9 ++++++--- os/kernel/src/chsys.c | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'os/kernel/src') diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c index d5c8a0a5a..7170fb0ec 100644 --- a/os/kernel/src/chschd.c +++ b/os/kernel/src/chschd.c @@ -96,7 +96,8 @@ void chSchGoSleepS(tstate_t newstate) { Thread *otp; (otp = currp)->p_state = newstate; - (currp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT; + setcurrp(fifo_remove(&rlist.r_queue)); + currp->p_state = THD_STATE_CURRENT; #if CH_TIME_QUANTUM > 0 rlist.r_preempt = CH_TIME_QUANTUM; #endif @@ -196,7 +197,8 @@ void chSchWakeupS(Thread *ntp, msg_t msg) { #if CH_TIME_QUANTUM > 0 rlist.r_preempt = CH_TIME_QUANTUM; #endif - (currp = ntp)->p_state = THD_STATE_CURRENT; + setcurrp(ntp); + ntp->p_state = THD_STATE_CURRENT; chDbgTrace(ntp, otp); chSysSwitchI(ntp, otp); } @@ -217,7 +219,8 @@ void chSchDoRescheduleI(void) { #endif otp = currp; /* Picks the first thread from the ready queue and makes it current.*/ - (currp = ntp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT; + (ntp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT; + setcurrp(ntp); chSchReadyI(otp); chDbgTrace(ntp, otp); chSysSwitchI(ntp, otp); diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c index eeed4a998..1a66c8e98 100644 --- a/os/kernel/src/chsys.c +++ b/os/kernel/src/chsys.c @@ -80,7 +80,8 @@ void chSysInit(void) { #endif /* Now this instructions flow becomes the main thread.*/ - (currp = init_thread(&mainthread, NORMALPRIO))->p_state = THD_STATE_CURRENT; + setcurrp(init_thread(&mainthread, NORMALPRIO)); + currp->p_state = THD_STATE_CURRENT; chSysEnable(); /* This thread has the lowest priority in the system, its role is just to -- cgit v1.2.3