diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-01-31 22:26:53 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-01-31 22:26:53 +0300 |
commit | d4d36c65fa14dabeb029b3e6157d85672ac176ad (patch) | |
tree | 6b51a0acf06f69560f583d44289be492fcfca663 | |
parent | 18281ee37eaa9409a6af0aeb3c1926bba36cba0f (diff) | |
download | unit-d4d36c65fa14dabeb029b3e6157d85672ac176ad.tar.gz unit-d4d36c65fa14dabeb029b3e6157d85672ac176ad.tar.bz2 |
Fixes of various issues introduced by refactoring.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_event_conn_proxy.c | 2 | ||||
-rw-r--r-- | src/nxt_event_engine.c | 30 | ||||
-rw-r--r-- | src/nxt_thread.c | 2 |
3 files changed, 25 insertions, 9 deletions
diff --git a/src/nxt_event_conn_proxy.c b/src/nxt_event_conn_proxy.c index ae1a1996..d5539070 100644 --- a/src/nxt_event_conn_proxy.c +++ b/src/nxt_event_conn_proxy.c @@ -85,6 +85,8 @@ nxt_event_conn_proxy_create(nxt_event_conn_t *client) thr = nxt_thread(); + client->read_work_queue = &thr->engine->read_work_queue; + client->write_work_queue = &thr->engine->write_work_queue; client->socket.read_work_queue = &thr->engine->read_work_queue; client->socket.write_work_queue = &thr->engine->write_work_queue; peer->socket.read_work_queue = &thr->engine->read_work_queue; 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); diff --git a/src/nxt_thread.c b/src/nxt_thread.c index 24136bde..78c6f50c 100644 --- a/src/nxt_thread.c +++ b/src/nxt_thread.c @@ -193,7 +193,7 @@ nxt_thread_exit(nxt_thread_t *thr) * and link->task is already set to engine->task. * The link should be freed by the exit handler. */ - link->work.obj = thr->handle; + link->work.obj = (void *) (uintptr_t) thr->handle; nxt_event_engine_post(link->engine, &link->work); } |