summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nxt_event_conn_proxy.c2
-rw-r--r--src/nxt_event_engine.c30
-rw-r--r--src/nxt_thread.c2
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);
}