Stop fiddling thread priority with msleep, eliminating unnecessary

context switching. This improves performance about 30% on UP machine.
This commit is contained in:
David Xu 2005-12-12 05:04:56 +00:00
parent 4b99735d08
commit dd1a6f53ac

View File

@ -1643,7 +1643,7 @@ _mqueue_send(struct mqueue *mq, struct mqueue_msg *msg, int timo)
}
mq->mq_senders++;
error = msleep(&mq->mq_senders, &mq->mq_mutex,
PSOCK | PCATCH, "mqsend", timo);
curthread->td_priority | PCATCH, "mqsend", timo);
mq->mq_senders--;
if (error == EAGAIN)
error = ETIMEDOUT;
@ -1795,7 +1795,7 @@ _mqueue_recv(struct mqueue *mq, struct mqueue_msg **msg, int timo)
}
mq->mq_receivers++;
error = msleep(&mq->mq_receivers, &mq->mq_mutex,
PSOCK | PCATCH, "mqrecv", timo);
curthread->td_priority | PCATCH, "mqrecv", timo);
mq->mq_receivers--;
if (error == EAGAIN)
error = ETIMEDOUT;