Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nathanw_sa]: src/lib/libpthread Convert to new queue type.



details:   https://anonhg.NetBSD.org/src/rev/2e30ead5b535
branches:  nathanw_sa
changeset: 504844:2e30ead5b535
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Fri Jul 13 02:15:59 2001 +0000

description:
Convert to new queue type.

diffstat:

 lib/libpthread/pthread_run.c |  23 +++++++++++------------
 lib/libpthread/pthread_sa.c  |   6 +++---
 2 files changed, 14 insertions(+), 15 deletions(-)

diffs (106 lines):

diff -r 47ba655ba35b -r 2e30ead5b535 lib/libpthread/pthread_run.c
--- a/lib/libpthread/pthread_run.c      Fri Jul 13 02:14:31 2001 +0000
+++ b/lib/libpthread/pthread_run.c      Fri Jul 13 02:15:59 2001 +0000
@@ -26,7 +26,6 @@
        next = pthread__next(self);
 
        pthread__locked_switch(self, next, queuelock);
-       
 }
 
 
@@ -37,14 +36,14 @@
        pthread_t next;
 
        pthread_spinlock(self, &runqueue_lock);
-       next = SIMPLEQ_FIRST(&runqueue);
+       next = PTQ_FIRST(&runqueue);
        if (next) {
                assert(next->pt_type == PT_THREAD_NORMAL);
-               SIMPLEQ_REMOVE_HEAD(&runqueue, next, pt_runq);
+               PTQ_REMOVE(&runqueue, next, pt_runq);
        } else {
-               next = SIMPLEQ_FIRST(&idlequeue);
+               next = PTQ_FIRST(&idlequeue);
                assert(next != 0);
-               SIMPLEQ_REMOVE_HEAD(&idlequeue, next, pt_runq);
+               PTQ_REMOVE(&idlequeue, next, pt_runq);
                assert(next->pt_type == PT_THREAD_IDLE);
        }
        pthread_spinunlock(self, &runqueue_lock);
@@ -61,7 +60,7 @@
        assert (thread->pt_type == PT_THREAD_NORMAL);
        thread->rescheds++;
        pthread_spinlock(self, &runqueue_lock);
-       SIMPLEQ_INSERT_TAIL(&runqueue, thread, pt_runq);
+       PTQ_INSERT_TAIL(&runqueue, thread, pt_runq);
        pthread_spinunlock(self, &runqueue_lock);
 }
 
@@ -80,7 +79,7 @@
        makecontext(thread->pt_uc, pthread__idle, 0);
 
        pthread_spinlock(self, &runqueue_lock);
-       SIMPLEQ_INSERT_TAIL(&idlequeue, thread, pt_runq);
+       PTQ_INSERT_TAIL(&idlequeue, thread, pt_runq);
        pthread_spinunlock(self, &runqueue_lock);
 }
 
@@ -91,9 +90,9 @@
        
        qhead = NULL;
        pthread_spinlock(self, &deadqueue_lock);
-       while (!SIMPLEQ_EMPTY(&reidlequeue)) {
-               idlethread = SIMPLEQ_FIRST(&reidlequeue);
-               SIMPLEQ_REMOVE_HEAD(&reidlequeue, idlethread, pt_runq);
+       while (!PTQ_EMPTY(&reidlequeue)) {
+               idlethread = PTQ_FIRST(&reidlequeue);
+               PTQ_REMOVE(&reidlequeue, idlethread, pt_runq);
                idlethread->pt_next = qhead;
                qhead = idlethread;
        }
@@ -119,7 +118,7 @@
                        qhead->pt_next = NULL;
                        qhead->pt_parent = NULL;
                        qhead->rescheds++;
-                       SIMPLEQ_INSERT_TAIL(&runqueue, qhead, pt_runq);
+                       PTQ_INSERT_TAIL(&runqueue, qhead, pt_runq);
                } else if (qhead->pt_type == PT_THREAD_IDLE) {
                        qhead->pt_next = NULL;
                        qhead->pt_parent = NULL;
@@ -127,7 +126,7 @@
                        qhead->pt_uc->uc_stack = qhead->pt_stack;
                        qhead->pt_uc->uc_link = NULL;
                        makecontext(qhead->pt_uc, pthread__idle, 0);
-                       SIMPLEQ_INSERT_TAIL(&idlequeue, qhead, pt_runq);
+                       PTQ_INSERT_TAIL(&idlequeue, qhead, pt_runq);
                }
        }
        pthread_spinunlock(self, &runqueue_lock);
diff -r 47ba655ba35b -r 2e30ead5b535 lib/libpthread/pthread_sa.c
--- a/lib/libpthread/pthread_sa.c       Fri Jul 13 02:14:31 2001 +0000
+++ b/lib/libpthread/pthread_sa.c       Fri Jul 13 02:15:59 2001 +0000
@@ -1,4 +1,4 @@
-/* $Id: pthread_sa.c,v 1.1.2.1 2001/03/05 23:51:59 nathanw Exp $ */
+/* $Id: pthread_sa.c,v 1.1.2.2 2001/07/13 02:16:24 nathanw Exp $ */
 
 /* Copyright */
 
@@ -16,7 +16,7 @@
 #include "pthread.h"
 #include "pthread_int.h"
 
-extern struct pt_list_t allqueue;
+extern struct pt_queue_t allqueue;
 
 stack_t recyclable[2][(PT_UPCALLSTACKS/2)+1];
 int    recycle_count;
@@ -401,7 +401,7 @@
                t->pt_flags = PT_FLAG_DETACHED;
                sigfillset(&t->pt_sigmask); /* XXX hmmmmmm */
                /* No locking needed, there are no threads yet. */
-               LIST_INSERT_HEAD(&allqueue, t, pt_allq);
+               PTQ_INSERT_HEAD(&allqueue, t, pt_allq);
        }
 
        recycle_threshold = PT_UPCALLSTACKS/2;



Home | Main Index | Thread Index | Old Index