diff options
author | mini <mini@FreeBSD.org> | 2002-11-24 06:45:45 +0000 |
---|---|---|
committer | mini <mini@FreeBSD.org> | 2002-11-24 06:45:45 +0000 |
commit | 930a90029b6caa57e0cf42fa13f6d4e6e14150cb (patch) | |
tree | a39e089818c7c2d431b3cee8a2b3effe72c651e5 /lib/libpthread | |
parent | a00a2d6daf8e1aa5488be408953670ca968c7625 (diff) | |
download | FreeBSD-src-930a90029b6caa57e0cf42fa13f6d4e6e14150cb.zip FreeBSD-src-930a90029b6caa57e0cf42fa13f6d4e6e14150cb.tar.gz |
Schedule spinlocked threads by moving them through the work queue, instead
of the wait queue.
Approved by: re (blanket)
Stolen from: davidxu
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/thread/thr_kern.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c index 087e1df..0747cff 100644 --- a/lib/libpthread/thread/thr_kern.c +++ b/lib/libpthread/thread/thr_kern.c @@ -166,7 +166,18 @@ _thread_kern_sched(void) case PS_SPINBLOCK: /* Increment spinblock count. */ _spinblock_count++; - /*FALLTHROUGH*/ + + /* No timeouts for these states. */ + curthread->wakeup_time.tv_sec = -1; + curthread->wakeup_time.tv_nsec = -1; + + /* Restart the time slice. */ + curthread->slice_usec = -1; + + /* Insert into the work queue. */ + PTHREAD_WORKQ_INSERT(curthread); + break; + case PS_DEADLOCK: case PS_JOIN: case PS_MUTEX_WAIT: @@ -288,7 +299,9 @@ _thread_kern_scheduler(struct kse_mailbox *km) access_lock == 0) { PTHREAD_WAITQ_CLEARACTIVE(); PTHREAD_WORKQ_REMOVE(pthread); - PTHREAD_NEW_STATE(pthread, + PTHREAD_PRIOQ_INSERT_TAIL( + pthread); + PTHREAD_SET_STATE(pthread, PS_RUNNING); PTHREAD_WAITQ_SETACTIVE(); |