diff options
author | Max Romanov <max.romanov@nginx.com> | 2020-11-18 22:33:53 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2020-11-18 22:33:53 +0300 |
commit | 300347a5cffa4187921384bdd02c5bb90875f9e5 (patch) | |
tree | 2120beadd49170d0a9a5e3b74ce61e1a5b3bc8b9 /src/nxt_unit.c | |
parent | 8132e1f700934a32bc9e3fb0ab66f550a335a326 (diff) | |
download | unit-300347a5cffa4187921384bdd02c5bb90875f9e5.tar.gz unit-300347a5cffa4187921384bdd02c5bb90875f9e5.tar.bz2 |
Libunit: making minor tweaks.
Removing unnecessary context operations from shared queue processing loop.
Initializing temporary queues only when required.
Diffstat (limited to 'src/nxt_unit.c')
-rw-r--r-- | src/nxt_unit.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/nxt_unit.c b/src/nxt_unit.c index 44525d04..e74c8370 100644 --- a/src/nxt_unit.c +++ b/src/nxt_unit.c @@ -4675,8 +4675,6 @@ nxt_unit_process_pending_rbuf(nxt_unit_ctx_t *ctx) nxt_unit_ctx_impl_t *ctx_impl; nxt_unit_read_buf_t *rbuf; - nxt_queue_init(&pending_rbuf); - ctx_impl = nxt_container_of(ctx, nxt_unit_ctx_impl_t, ctx); pthread_mutex_lock(&ctx_impl->mutex); @@ -4687,6 +4685,8 @@ nxt_unit_process_pending_rbuf(nxt_unit_ctx_t *ctx) return NXT_UNIT_OK; } + nxt_queue_init(&pending_rbuf); + nxt_queue_add(&pending_rbuf, &ctx_impl->pending_rbuf); nxt_queue_init(&ctx_impl->pending_rbuf); @@ -4719,8 +4719,6 @@ nxt_unit_process_ready_req(nxt_unit_ctx_t *ctx) nxt_unit_request_info_t *req; nxt_unit_request_info_impl_t *req_impl; - nxt_queue_init(&ready_req); - ctx_impl = nxt_container_of(ctx, nxt_unit_ctx_impl_t, ctx); pthread_mutex_lock(&ctx_impl->mutex); @@ -4731,6 +4729,8 @@ nxt_unit_process_ready_req(nxt_unit_ctx_t *ctx) return; } + nxt_queue_init(&ready_req); + nxt_queue_add(&ready_req, &ctx_impl->ready_req); nxt_queue_init(&ctx_impl->ready_req); @@ -4917,13 +4917,6 @@ nxt_unit_run_shared(nxt_unit_ctx_t *ctx) if (nxt_slow_path(rc == NXT_UNIT_ERROR)) { break; } - - rc = nxt_unit_process_pending_rbuf(ctx); - if (nxt_slow_path(rc == NXT_UNIT_ERROR)) { - break; - } - - nxt_unit_process_ready_req(ctx); } nxt_unit_ctx_release(ctx); |