Schedule spinlocked threads by moving them through the work queue, instead

of the wait queue.

Approved by: re (blanket)
Stolen from: davidxu
This commit is contained in:
Jonathan Mini 2002-11-24 06:45:45 +00:00
parent 4df51f23bb
commit e9d0431f0b
2 changed files with 30 additions and 4 deletions

View File

@ -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();

View File

@ -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();