diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-10-01 17:42:47 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-10-01 17:42:47 +0000 |
commit | 3a90ab685aaae59f242ae31260e67e9125ae78cd (patch) | |
tree | 1413d1fa5a06ee7e720a1de121c537bb1ecb1c45 /src/chthreads.c | |
parent | 9a0ef300bce50901d5de3d6d722e29b79a2f9a36 (diff) | |
download | ChibiOS-3a90ab685aaae59f242ae31260e67e9125ae78cd.tar.gz ChibiOS-3a90ab685aaae59f242ae31260e67e9125ae78cd.tar.bz2 ChibiOS-3a90ab685aaae59f242ae31260e67e9125ae78cd.zip |
Preparation for AVR core support.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@27 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chthreads.c')
-rw-r--r-- | src/chthreads.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/src/chthreads.c b/src/chthreads.c index a439eb5b4..608dabe89 100644 --- a/src/chthreads.c +++ b/src/chthreads.c @@ -24,33 +24,6 @@ #include <ch.h>
-#ifndef CH_OPTIMIZE_SPEED
-/*
- * Removes a Thread from a list and returns it.
- * @param tp the pointer to the thread to be removed from the list
- * @return the removed thread pointer
- */
-Thread *dequeue(Thread *tp) {
-
- tp->p_prev->p_next = tp->p_next;
- tp->p_next->p_prev = tp->p_prev;
- return tp;
-}
-
-/*
- * Inserts a thread into a bi-directional list in FIFO order.
- * @param tp the pointer to the thread to be inserted in the list
- * @param tqp the pointer to the threads list header
- */
-void enqueue(Thread *tp, ThreadsQueue *tqp) {
-
- tp->p_next = (Thread *)tqp;
- tp->p_prev = tqp->p_prev;
- tqp->p_prev->p_next = tp;
- tqp->p_prev = tp;
-}
-#endif /* CH_OPTIMIZE_SPEED */
-
/*
* Initializes a thread structure.
*/
@@ -63,12 +36,10 @@ void _InitThread(t_prio prio, t_tmode mode, Thread *tp) { tp->p_rtcnt = 0;
#endif
#ifdef CH_USE_WAITEXIT
- tp->p_waiting.p_next = (Thread *)&tp->p_waiting;
- tp->p_waiting.p_prev = (Thread *)&tp->p_waiting;
+ list_init(&tp->p_waiting);
#endif
#ifdef CH_USE_MESSAGES
- tp->p_msgqueue.p_next = (Thread *)&tp->p_msgqueue;
- tp->p_msgqueue.p_prev = (Thread *)&tp->p_msgqueue;
+ fifo_init(&tp->p_msgqueue);
#endif
#ifdef CH_USE_EVENTS
tp->p_epending = 0;
@@ -179,7 +150,7 @@ void chThdExit(t_msg msg) { currp->p_exitcode = msg; /* Post mortem info. */
#ifdef CH_USE_WAITEXIT
while (notempty(&currp->p_waiting))
- chSchReadyI(dequeue(currp->p_waiting.p_next));
+ chSchReadyI(list_remove(&currp->p_waiting));
#endif
#ifdef CH_USE_EXIT_EVENT
chEvtSendI(&currp->p_exitesource);
@@ -203,7 +174,7 @@ t_msg chThdWait(Thread *tp) { chSysLock();
if (tp->p_state != PREXIT) {
- enqueue(currp, &tp->p_waiting);
+ list_insert(currp, &tp->p_waiting);
chSchGoSleepI(PRWAIT);
}
|