summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_event_engine.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-01-31 22:26:53 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-01-31 22:26:53 +0300
commitd4d36c65fa14dabeb029b3e6157d85672ac176ad (patch)
tree6b51a0acf06f69560f583d44289be492fcfca663 /src/nxt_event_engine.c
parent18281ee37eaa9409a6af0aeb3c1926bba36cba0f (diff)
downloadunit-d4d36c65fa14dabeb029b3e6157d85672ac176ad.tar.gz
unit-d4d36c65fa14dabeb029b3e6157d85672ac176ad.tar.bz2
Fixes of various issues introduced by refactoring.
Diffstat (limited to 'src/nxt_event_engine.c')
-rw-r--r--src/nxt_event_engine.c30
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);