diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-03-12 21:56:13 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-03-12 21:56:13 +0000 |
commit | a0bd39523f36cdc7676d9f15e7f0c142d4107664 (patch) | |
tree | 7fe228d0de153c1501dfb7d0a74a1f7cbe811e7d /src/chschd.c | |
parent | f43dbdc61b885a617a0e8d73bf565e48ee4d96ba (diff) | |
download | ChibiOS-a0bd39523f36cdc7676d9f15e7f0c142d4107664.tar.gz ChibiOS-a0bd39523f36cdc7676d9f15e7f0c142d4107664.tar.bz2 ChibiOS-a0bd39523f36cdc7676d9f15e7f0c142d4107664.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@835 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chschd.c')
-rw-r--r-- | src/chschd.c | 29 |
1 files changed, 28 insertions, 1 deletions
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); } |