From a0bd39523f36cdc7676d9f15e7f0c142d4107664 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 12 Mar 2009 21:56:13 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@835 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chschd.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/chschd.c b/src/chschd.c index 920f9fc61..cfc2355dc 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -52,6 +52,7 @@ void scheduler_init(void) { * @note The function does not reschedule, the @p chSchRescheduleS() should * be called soon after. */ +#if 0 #if CH_OPTIMIZE_SPEED /* NOTE: it is inlined in this module only.*/ INLINE Thread *chSchReadyI(Thread *tp) { @@ -69,6 +70,28 @@ Thread *chSchReadyI(Thread *tp) { tp->p_prev->p_next = cp->p_prev = tp; return tp; } +#endif + +#if 1 +#if CH_OPTIMIZE_SPEED +/* NOTE: it is inlined in this module only.*/ +INLINE Thread *chSchReadyI(Thread *tp) { +#else +Thread *chSchReadyI(Thread *tp) { +#endif + Thread *cp; + + tp->p_state = PRREADY; + cp = (void *)&rlist; + do { + cp = cp->p_next; + } while (cp->p_prio >= tp->p_prio); + /* Insertion on p_prev.*/ + tp->p_prev = (tp->p_next = cp)->p_prev; + tp->p_prev->p_next = cp->p_prev = tp; + return tp; +} +#endif /** * @brief Puts the current thread to sleep into the specified state. @@ -104,8 +127,12 @@ static void wakeup(void *p) { chSemFastSignalI(tp->p_wtsemp); /* Falls into, intentional. */ #endif - case PRWTCOND: +#if CH_USE_MUTEXES case PRWTMTX: +#endif +#if CH_USE_CONDVARS + case PRWTCOND: +#endif /* States requiring dequeuing. */ dequeue(tp); }