diff options
Diffstat (limited to 'os/kernel/src')
-rw-r--r-- | os/kernel/src/chschd.c | 9 | ||||
-rw-r--r-- | os/kernel/src/chsys.c | 3 |
2 files changed, 8 insertions, 4 deletions
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
|