diff options
| author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-12-22 11:34:39 +0000 | 
|---|---|---|
| committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-12-22 11:34:39 +0000 | 
| commit | cf3378588cedd2015f8c59b77fcc3fb8f9164ec8 (patch) | |
| tree | 95c80e51c9f14ccd95af5da97a560a57bbd87224 /src/chlists.c | |
| parent | 6c8aadd17a89d399a8ee2e77d5885f4db3bcab06 (diff) | |
| download | ChibiOS-cf3378588cedd2015f8c59b77fcc3fb8f9164ec8.tar.gz ChibiOS-cf3378588cedd2015f8c59b77fcc3fb8f9164ec8.tar.bz2 ChibiOS-cf3378588cedd2015f8c59b77fcc3fb8f9164ec8.zip | |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@155 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chlists.c')
| -rw-r--r-- | src/chlists.c | 19 | 
1 files changed, 18 insertions, 1 deletions
| diff --git a/src/chlists.c b/src/chlists.c index 7994f8ac6..37db948b2 100644 --- a/src/chlists.c +++ b/src/chlists.c @@ -18,13 +18,30 @@  */
  /**
 - * @addtogroup Messages
 + * @addtogroup Threads
   * @{
   */
  #include <ch.h>
  #ifndef CH_OPTIMIZE_SPEED
  /*
 + * Inserts a thread into a priority ordered queue.
 + * @param tp the pointer to the thread to be inserted in the list
 + * @param tqp the pointer to the threads list header
 + * @note the insertion is done by scanning the list from the highest priority
 + *       toward the lowest
 + */
 +void prio_insert(Thread *tp, ThreadsQueue *tqp) {
 +
 +  Thread *cp = tqp->p_next;
 +  while ((cp != (Thread *)tqp) && (cp->p_prio >= tp->p_prio))
 +    cp = cp->p_next;
 +  /* Insertion on p_prev.*/
 +  tp->p_prev = (tp->p_next = cp)->p_prev;
 +  tp->p_prev->p_next = cp->p_prev = tp;
 +}
 +
 +/*
   * Inserts a thread into a FIFO queue.
   * @param tp the pointer to the thread to be inserted in the list
   * @param tqp the pointer to the threads list header
 | 
