aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-03-12 15:23:10 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-03-12 15:23:10 +0000
commit9d69c31143d011b0345598a6c1e4732c0f2a736e (patch)
treeb043396198ed17fe76f60b915d0139fc7cff9f04 /src
parent1422b47cc4e0a979ff02e9d8fb1bb0005f0ebbb9 (diff)
downloadChibiOS-9d69c31143d011b0345598a6c1e4732c0f2a736e.tar.gz
ChibiOS-9d69c31143d011b0345598a6c1e4732c0f2a736e.tar.bz2
ChibiOS-9d69c31143d011b0345598a6c1e4732c0f2a736e.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@226 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src')
-rw-r--r--src/chschd.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/chschd.c b/src/chschd.c
index 20e5f5d78..70c867535 100644
--- a/src/chschd.c
+++ b/src/chschd.c
@@ -55,12 +55,11 @@ void chSchInit(void) {
/* NOTE: it is inlined in this module only.*/
INLINE Thread *chSchReadyI(Thread *tp) {
#else
-void chSchReadyI(Thread *tp) {
+Thread *chSchReadyI(Thread *tp) {
#endif
Thread *cp;
tp->p_state = PRREADY;
-// tp->p_rdymsg = RDY_OK;
cp = rlist.r_queue.p_next;
while (cp->p_prio >= tp->p_prio)
cp = cp->p_next;
@@ -100,7 +99,7 @@ static void wakeup(void *p) {
if (((Thread *)p)->p_state == PRWTSEM)
chSemFastSignalI(((Thread *)p)->p_wtsemp);
#endif
- chSchReadyI(p)->p_rdymsg = RDY_TIMEOUT;;
+ chSchReadyI(p)->p_rdymsg = RDY_TIMEOUT;
}
/**
@@ -185,16 +184,10 @@ void chSchRescheduleS(void) {
* immediatly else \p FALSE.
*/
bool_t chSchRescRequiredI(void) {
+ tprio_t p1 = firstprio(&rlist.r_queue);
+ tprio_t p2 = currp->p_prio;
- if (rlist.r_preempt) {
- if (firstprio(&rlist.r_queue) <= currp->p_prio)
- return FALSE;
- }
- else { /* Time quantum elapsed. */
- if (firstprio(&rlist.r_queue) < currp->p_prio)
- return FALSE;
- }
- return TRUE;
+ return rlist.r_preempt ? p1 > p2 : p1 >= p2;
}
/** @} */