diff options
Diffstat (limited to '')
-rw-r--r-- | src/nxt_event_engine.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/nxt_event_engine.c b/src/nxt_event_engine.c index 0765af71..ea7fbe62 100644 --- a/src/nxt_event_engine.c +++ b/src/nxt_event_engine.c @@ -459,25 +459,39 @@ static nxt_work_handler_t nxt_event_engine_queue_pop(nxt_event_engine_t *engine, nxt_task_t **task, void **obj, void **data) { - nxt_work_queue_t *wq; + nxt_work_queue_t *wq, *last; wq = engine->current_work_queue; + last = wq; if (wq->head == NULL) { wq = &engine->fast_work_queue; - while (wq->head == NULL) { - engine->current_work_queue++; - wq = engine->current_work_queue; + if (wq->head == NULL) { - if (wq > &engine->final_work_queue) { - engine->current_work_queue = &engine->fast_work_queue; + do { + engine->current_work_queue++; + wq = engine->current_work_queue; - return NULL; - } + if (wq > &engine->final_work_queue) { + wq = &engine->fast_work_queue; + engine->current_work_queue = wq; + } + + if (wq->head != NULL) { + goto found; + } + + } while (wq != last); + + engine->current_work_queue = &engine->fast_work_queue; + + return NULL; } } +found: + nxt_debug(&engine->task, "work queue: %s", wq->name); return nxt_work_queue_pop(wq, task, obj, data); |