Better comments.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9173 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
307d87bdec
commit
b11ee36528
|
@ -287,25 +287,28 @@ thread_t *chSchReadyAheadI(thread_t *tp) {
|
||||||
* @sclass
|
* @sclass
|
||||||
*/
|
*/
|
||||||
void chSchGoSleepS(tstate_t newstate) {
|
void chSchGoSleepS(tstate_t newstate) {
|
||||||
thread_t *otp;
|
thread_t *otp = currp;
|
||||||
|
|
||||||
chDbgCheckClassS();
|
chDbgCheckClassS();
|
||||||
|
|
||||||
otp = currp;
|
/* New state.*/
|
||||||
otp->state = newstate;
|
otp->state = newstate;
|
||||||
|
|
||||||
#if CH_CFG_TIME_QUANTUM > 0
|
#if CH_CFG_TIME_QUANTUM > 0
|
||||||
/* The thread is renouncing its remaining time slices so it will have a new
|
/* The thread is renouncing its remaining time slices so it will have a new
|
||||||
time quantum when it will wakeup.*/
|
time quantum when it will wakeup.*/
|
||||||
otp->preempt = (tslices_t)CH_CFG_TIME_QUANTUM;
|
otp->preempt = (tslices_t)CH_CFG_TIME_QUANTUM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Next thread in ready list becomes current.*/
|
||||||
currp = queue_fifo_remove(&ch.rlist.queue);
|
currp = queue_fifo_remove(&ch.rlist.queue);
|
||||||
|
currp->state = CH_STATE_CURRENT;
|
||||||
|
|
||||||
|
/* Handling idle-enter hook.*/
|
||||||
if (currp->prio == IDLEPRIO) {
|
if (currp->prio == IDLEPRIO) {
|
||||||
CH_CFG_IDLE_ENTER_HOOK();
|
CH_CFG_IDLE_ENTER_HOOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The extracted thread is marked as current.*/
|
|
||||||
currp->state = CH_STATE_CURRENT;
|
|
||||||
|
|
||||||
/* Swap operation as tail call.*/
|
/* Swap operation as tail call.*/
|
||||||
chSysSwitch(currp, otp);
|
chSysSwitch(currp, otp);
|
||||||
}
|
}
|
||||||
|
@ -426,13 +429,15 @@ void chSchWakeupS(thread_t *ntp, msg_t msg) {
|
||||||
(void) chSchReadyI(ntp);
|
(void) chSchReadyI(ntp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
currp = ntp;
|
|
||||||
otp = chSchReadyI(otp);
|
otp = chSchReadyI(otp);
|
||||||
|
|
||||||
|
/* Handling idle-leave hook.*/
|
||||||
if (otp->prio == IDLEPRIO) {
|
if (otp->prio == IDLEPRIO) {
|
||||||
CH_CFG_IDLE_LEAVE_HOOK();
|
CH_CFG_IDLE_LEAVE_HOOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The extracted thread is marked as current.*/
|
/* The extracted thread is marked as current.*/
|
||||||
|
currp = ntp;
|
||||||
ntp->state = CH_STATE_CURRENT;
|
ntp->state = CH_STATE_CURRENT;
|
||||||
|
|
||||||
/* Swap operation as tail call.*/
|
/* Swap operation as tail call.*/
|
||||||
|
@ -501,14 +506,15 @@ void chSchDoRescheduleBehind(void) {
|
||||||
|
|
||||||
/* Picks the first thread from the ready queue and makes it current.*/
|
/* Picks the first thread from the ready queue and makes it current.*/
|
||||||
currp = queue_fifo_remove(&ch.rlist.queue);
|
currp = queue_fifo_remove(&ch.rlist.queue);
|
||||||
|
currp->state = CH_STATE_CURRENT;
|
||||||
|
|
||||||
|
/* Handling idle-leave hook.*/
|
||||||
if (otp->prio == IDLEPRIO) {
|
if (otp->prio == IDLEPRIO) {
|
||||||
CH_CFG_IDLE_LEAVE_HOOK();
|
CH_CFG_IDLE_LEAVE_HOOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The extracted thread is marked as current.*/
|
|
||||||
currp->state = CH_STATE_CURRENT;
|
|
||||||
|
|
||||||
#if CH_CFG_TIME_QUANTUM > 0
|
#if CH_CFG_TIME_QUANTUM > 0
|
||||||
|
/* It went behind peers so it gets a new time quantum.*/
|
||||||
otp->preempt = (tslices_t)CH_CFG_TIME_QUANTUM;
|
otp->preempt = (tslices_t)CH_CFG_TIME_QUANTUM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -533,13 +539,13 @@ void chSchDoRescheduleAhead(void) {
|
||||||
|
|
||||||
/* Picks the first thread from the ready queue and makes it current.*/
|
/* Picks the first thread from the ready queue and makes it current.*/
|
||||||
currp = queue_fifo_remove(&ch.rlist.queue);
|
currp = queue_fifo_remove(&ch.rlist.queue);
|
||||||
|
currp->state = CH_STATE_CURRENT;
|
||||||
|
|
||||||
|
/* Handling idle-leave hook.*/
|
||||||
if (otp->prio == IDLEPRIO) {
|
if (otp->prio == IDLEPRIO) {
|
||||||
CH_CFG_IDLE_LEAVE_HOOK();
|
CH_CFG_IDLE_LEAVE_HOOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The extracted thread is marked as current.*/
|
|
||||||
currp->state = CH_STATE_CURRENT;
|
|
||||||
|
|
||||||
/* Placing in ready list ahead of peers.*/
|
/* Placing in ready list ahead of peers.*/
|
||||||
otp = chSchReadyAheadI(otp);
|
otp = chSchReadyAheadI(otp);
|
||||||
|
|
||||||
|
@ -562,13 +568,13 @@ void chSchDoReschedule(void) {
|
||||||
|
|
||||||
/* Picks the first thread from the ready queue and makes it current.*/
|
/* Picks the first thread from the ready queue and makes it current.*/
|
||||||
currp = queue_fifo_remove(&ch.rlist.queue);
|
currp = queue_fifo_remove(&ch.rlist.queue);
|
||||||
|
currp->state = CH_STATE_CURRENT;
|
||||||
|
|
||||||
|
/* Handling idle-leave hook.*/
|
||||||
if (otp->prio == IDLEPRIO) {
|
if (otp->prio == IDLEPRIO) {
|
||||||
CH_CFG_IDLE_LEAVE_HOOK();
|
CH_CFG_IDLE_LEAVE_HOOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The extracted thread is marked as current.*/
|
|
||||||
currp->state = CH_STATE_CURRENT;
|
|
||||||
|
|
||||||
#if CH_CFG_TIME_QUANTUM > 0
|
#if CH_CFG_TIME_QUANTUM > 0
|
||||||
/* If CH_CFG_TIME_QUANTUM is enabled then there are two different scenarios
|
/* If CH_CFG_TIME_QUANTUM is enabled then there are two different scenarios
|
||||||
to handle on preemption: time quantum elapsed or not.*/
|
to handle on preemption: time quantum elapsed or not.*/
|
||||||
|
|
Loading…
Reference in New Issue