diff options
author | deischen <deischen@FreeBSD.org> | 2003-04-28 23:56:12 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2003-04-28 23:56:12 +0000 |
commit | 6deabb439b7870759f16db0c9a3968e3755bf61a (patch) | |
tree | 90f4ce3660289c401aab5d0a2c4f105e5aa3e877 /lib/libpthread/thread/thr_priority_queue.c | |
parent | 0fbdf3450d750b66e54d688d645fc4bafd8739a1 (diff) | |
download | FreeBSD-src-6deabb439b7870759f16db0c9a3968e3755bf61a.zip FreeBSD-src-6deabb439b7870759f16db0c9a3968e3755bf61a.tar.gz |
o Don't add a scope system thread's KSE to the list of available
KSEs when it's thread exits; allow the GC handler to do that.
o Make spinlock/spinlock critical regions.
The following were submitted by davidxu
o Alow thr_switch() to take a null mailbox argument.
o Better protect cancellation checks.
o Don't set KSE specific data when creating new KSEs; rely on the
first upcall of the KSE to set it.
o Add the ability to set the maximum concurrency level and do this
automatically. We should have a way to enable/disable this with
some sort of tunable because some applications may not want this
to be the default.
o Hold the scheduling lock across thread switch calls.
o If scheduling of a thread fails, make sure to remove it from the list
of active threads.
o Better protect accesses to a joining threads when the target thread is
exited and detached.
o Remove some macro definitions that are now provided by <sys/kse.h>.
o Don't leave the library in threaded mode if creation of the initial
KSE fails.
o Wakeup idle KSEs when there are threads ready to run.
o Maintain the number of threads active in the priority queue.
Diffstat (limited to 'lib/libpthread/thread/thr_priority_queue.c')
-rw-r--r-- | lib/libpthread/thread/thr_priority_queue.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libpthread/thread/thr_priority_queue.c b/lib/libpthread/thread/thr_priority_queue.c index 3f261f8..2822aa8 100644 --- a/lib/libpthread/thread/thr_priority_queue.c +++ b/lib/libpthread/thread/thr_priority_queue.c @@ -126,6 +126,7 @@ _pq_init(pq_queue_t *pq) /* Initialize the priority queue: */ TAILQ_INIT(&pq->pq_queue); pq->pq_flags = 0; + pq->pq_threads = 0; } return (ret); } @@ -151,10 +152,10 @@ _pq_remove(pq_queue_t *pq, pthread_t pthread) * from the priority queue when _pq_first is called. */ TAILQ_REMOVE(&pq->pq_lists[prio].pl_head, pthread, pqe); - + pq->pq_threads--; /* This thread is now longer in the priority queue. */ pthread->flags &= ~THR_FLAGS_IN_RUNQ; - + PQ_CLEAR_ACTIVE(pq); } @@ -177,7 +178,7 @@ _pq_insert_head(pq_queue_t *pq, pthread_t pthread) if (pq->pq_lists[prio].pl_queued == 0) /* Insert the list into the priority queue: */ pq_insert_prio_list(pq, prio); - + pq->pq_threads++; /* Mark this thread as being in the priority queue. */ pthread->flags |= THR_FLAGS_IN_RUNQ; @@ -203,7 +204,7 @@ _pq_insert_tail(pq_queue_t *pq, pthread_t pthread) if (pq->pq_lists[prio].pl_queued == 0) /* Insert the list into the priority queue: */ pq_insert_prio_list(pq, prio); - + pq->pq_threads++; /* Mark this thread as being in the priority queue. */ pthread->flags |= THR_FLAGS_IN_RUNQ; |