summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_event_engine.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-03-09 18:03:27 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-03-09 18:03:27 +0300
commit6f2c9acd1841ca20a1388b34aef64e9f00459090 (patch)
treec0b9c1063ec464027d1ca29a793f6c0b7a6878d5 /src/nxt_event_engine.c
parent5745e4826427155e29c1d520fe77811a0f570689 (diff)
downloadunit-6f2c9acd1841ca20a1388b34aef64e9f00459090.tar.gz
unit-6f2c9acd1841ca20a1388b34aef64e9f00459090.tar.bz2
Processes refactoring.
The cycle has been renamed to the runtime.
Diffstat (limited to '')
-rw-r--r--src/nxt_event_engine.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/nxt_event_engine.c b/src/nxt_event_engine.c
index ca79e8ed..bd10a270 100644
--- a/src/nxt_event_engine.c
+++ b/src/nxt_event_engine.c
@@ -25,11 +25,12 @@ static nxt_work_handler_t nxt_event_engine_queue_pop(nxt_event_engine_t *engine,
nxt_event_engine_t *
-nxt_event_engine_create(nxt_thread_t *thr,
+nxt_event_engine_create(nxt_task_t *task,
const nxt_event_interface_t *interface, const nxt_sig_event_t *signals,
nxt_uint_t flags, nxt_uint_t batch)
{
nxt_uint_t events;
+ nxt_thread_t *thread;
nxt_event_engine_t *engine;
engine = nxt_zalloc(sizeof(nxt_event_engine_t));
@@ -37,14 +38,16 @@ nxt_event_engine_create(nxt_thread_t *thr,
return NULL;
}
- engine->task.thread = thr;
- engine->task.log = thr->log;
+ thread = task->thread;
+
+ engine->task.thread = thread;
+ engine->task.log = thread->log;
engine->task.ident = nxt_task_next_ident();
- thr->engine = engine;
- thr->fiber = &engine->fibers->fiber;
+ thread->engine = engine;
+ thread->fiber = &engine->fibers->fiber;
- engine->batch0 = batch;
+ engine->batch = batch;
if (flags & NXT_ENGINE_FIBERS) {
engine->fibers = nxt_fiber_main_create(engine);
@@ -111,8 +114,10 @@ nxt_event_engine_create(nxt_thread_t *thr,
goto timers_fail;
}
- nxt_thread_time_update(thr);
- engine->timers.now = nxt_thread_monotonic_time(thr) / 1000000;
+ thread = task->thread;
+
+ nxt_thread_time_update(thread);
+ engine->timers.now = nxt_thread_monotonic_time(thread) / 1000000;
engine->max_connections = 0xffffffff;
@@ -122,7 +127,7 @@ nxt_event_engine_create(nxt_thread_t *thr,
#if !(NXT_THREADS)
if (interface->signal_support) {
- thr->time.signal = -1;
+ thread->time.signal = -1;
}
#endif
@@ -368,14 +373,12 @@ nxt_event_engine_signal_handler(nxt_task_t *task, void *obj, void *data)
nxt_int_t
-nxt_event_engine_change(nxt_thread_t *thr, nxt_task_t *task,
+nxt_event_engine_change(nxt_event_engine_t *engine,
const nxt_event_interface_t *interface, nxt_uint_t batch)
{
- nxt_uint_t events;
- nxt_event_engine_t *engine;
+ nxt_uint_t events;
- engine = thr->engine;
- engine->batch0 = batch;
+ engine->batch = batch;
if (!engine->event.signal_support && interface->signal_support) {
/*
@@ -388,7 +391,7 @@ nxt_event_engine_change(nxt_thread_t *thr, nxt_task_t *task,
* Add to engine fast work queue the signal events possibly
* received before the blocking signal processing.
*/
- nxt_event_engine_signal_pipe(task, &engine->pipe->event, NULL);
+ nxt_event_engine_signal_pipe(&engine->task, &engine->pipe->event, NULL);
}
if (engine->pipe != NULL && interface->enable_post != NULL) {