diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-05-31 15:26:45 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-05-31 15:26:45 +0300 |
commit | 5bc011afad76fe7576ef0e0ed7ca7eb5417cf338 (patch) | |
tree | 0db06be61c62ecabb5225f69688da8ab4424aa36 /src/nxt_runtime.c | |
parent | dee819daabe6e7ab462beac779ab0dfd7d648844 (diff) | |
download | unit-5bc011afad76fe7576ef0e0ed7ca7eb5417cf338.tar.gz unit-5bc011afad76fe7576ef0e0ed7ca7eb5417cf338.tar.bz2 |
Skeleton of router configuration and request processing.
Diffstat (limited to 'src/nxt_runtime.c')
-rw-r--r-- | src/nxt_runtime.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c index 8337712a..5678f522 100644 --- a/src/nxt_runtime.c +++ b/src/nxt_runtime.c @@ -253,20 +253,10 @@ nxt_runtime_systemd_listen_sockets(nxt_task_t *task, nxt_runtime_t *rt) static nxt_int_t nxt_runtime_event_engines(nxt_task_t *task, nxt_runtime_t *rt) { - nxt_event_engine_t *engine, **e; + nxt_thread_t *thread; + nxt_event_engine_t *engine; const nxt_event_interface_t *interface; - rt->engines = nxt_array_create(rt->mem_pool, 1, - sizeof(nxt_event_engine_t *)); - if (nxt_slow_path(rt->engines == NULL)) { - return NXT_ERROR; - } - - e = nxt_array_add(rt->engines); - if (nxt_slow_path(e == NULL)) { - return NXT_ERROR; - } - interface = nxt_service_get(rt->services, "engine", NULL); if (nxt_slow_path(interface == NULL)) { @@ -281,8 +271,14 @@ nxt_runtime_event_engines(nxt_task_t *task, nxt_runtime_t *rt) return NXT_ERROR; } + thread = task->thread; + thread->engine = engine; + thread->fiber = &engine->fibers->fiber; + engine->id = rt->last_engine_id++; - *e = engine; + + nxt_queue_init(&rt->engines); + nxt_queue_insert_tail(&rt->engines, &engine->link); return NXT_OK; } @@ -587,12 +583,13 @@ nxt_runtime_event_engine_change(nxt_task_t *task, nxt_runtime_t *rt) void nxt_runtime_event_engine_free(nxt_runtime_t *rt) { - nxt_event_engine_t *engine, **engines; + nxt_queue_link_t *link; + nxt_event_engine_t *engine; - engines = rt->engines->elts; - engine = engines[0]; - nxt_array_remove(rt->engines, &engines[0]); + link = nxt_queue_first(&rt->engines); + nxt_queue_remove(link); + engine = nxt_queue_link_data(link, nxt_event_engine_t, link); nxt_event_engine_free(engine); } |