Changeset 55b77d9 in mainline for kernel/generic/src/proc/scheduler.c


Ignore:
Timestamp:
2011-06-17T20:39:16Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8f164724
Parents:
98caf49
Message:

Separate list_t typedef from link_t (kernel part).

  • list_t represents lists
  • Use list_first(), list_last(), list_empty() where appropriate
  • Use list_foreach() where possible
  • Replace improper uses of list_prepend() with list_insert_after()
  • Replace improper uses of list_append() with list_insert_before()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/scheduler.c

    r98caf49 r55b77d9  
    237237                 * Take the first thread from the queue.
    238238                 */
    239                 thread_t *thread =
    240                     list_get_instance(CPU->rq[i].rq_head.next, thread_t, rq_link);
     239                thread_t *thread = list_get_instance(
     240                    list_first(&CPU->rq[i].rq), thread_t, rq_link);
    241241                list_remove(&thread->rq_link);
    242242               
     
    273273static void relink_rq(int start)
    274274{
    275         link_t head;
    276        
    277         list_initialize(&head);
     275        list_t list;
     276       
     277        list_initialize(&list);
    278278        irq_spinlock_lock(&CPU->lock, false);
    279279       
     
    284284                       
    285285                        irq_spinlock_lock(&CPU->rq[i + 1].lock, false);
    286                         list_concat(&head, &CPU->rq[i + 1].rq_head);
     286                        list_concat(&list, &CPU->rq[i + 1].rq);
    287287                        size_t n = CPU->rq[i + 1].n;
    288288                        CPU->rq[i + 1].n = 0;
     
    292292                       
    293293                        irq_spinlock_lock(&CPU->rq[i].lock, false);
    294                         list_concat(&CPU->rq[i].rq_head, &head);
     294                        list_concat(&CPU->rq[i].rq, &list);
    295295                        CPU->rq[i].n += n;
    296296                        irq_spinlock_unlock(&CPU->rq[i].lock, false);
     
    616616                       
    617617                        /* Search rq from the back */
    618                         link_t *link = cpu->rq[rq].rq_head.prev;
    619                        
    620                         while (link != &(cpu->rq[rq].rq_head)) {
     618                        link_t *link = cpu->rq[rq].rq.head.prev;
     619                       
     620                        while (link != &(cpu->rq[rq].rq.head)) {
    621621                                thread = (thread_t *) list_get_instance(link,
    622622                                    thread_t, rq_link);
     
    740740                       
    741741                        printf("\trq[%u]: ", i);
    742                         link_t *cur;
    743                         for (cur = cpus[cpu].rq[i].rq_head.next;
    744                             cur != &(cpus[cpu].rq[i].rq_head);
    745                             cur = cur->next) {
    746                                 thread_t *thread = list_get_instance(cur, thread_t, rq_link);
     742                        list_foreach(cpus[cpu].rq[i].rq, cur) {
     743                                thread_t *thread = list_get_instance(cur,
     744                                    thread_t, rq_link);
    747745                                printf("%" PRIu64 "(%s) ", thread->tid,
    748746                                    thread_states[thread->state]);
Note: See TracChangeset for help on using the changeset viewer.