Do fastpath if timeout is 0 on threadqueue_get
This commit is contained in:
@@ -126,7 +126,12 @@ int uc_thread_queue_get(struct uc_threadqueue *queue, const struct timespec *tim
|
|||||||
//another thread popped the remaining elment before we did
|
//another thread popped the remaining elment before we did
|
||||||
queue->num_read_waiters++;
|
queue->num_read_waiters++;
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
|
//fastpath, check for a poll
|
||||||
|
if(timeout->tv_sec == 0 && timeout->tv_nsec == 0) {
|
||||||
|
rc = ETIMEDOUT;
|
||||||
|
} else {
|
||||||
rc = pthread_cond_timedwait(&queue->read_cond, &queue->mutex, &abstimeout);
|
rc = pthread_cond_timedwait(&queue->read_cond, &queue->mutex, &abstimeout);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pthread_cond_wait(&queue->read_cond, &queue->mutex);
|
pthread_cond_wait(&queue->read_cond, &queue->mutex);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user