summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_lib.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_lib.c
parent5745e4826427155e29c1d520fe77811a0f570689 (diff)
downloadunit-6f2c9acd1841ca20a1388b34aef64e9f00459090.tar.gz
unit-6f2c9acd1841ca20a1388b34aef64e9f00459090.tar.bz2
Processes refactoring.
The cycle has been renamed to the runtime.
Diffstat (limited to 'src/nxt_lib.c')
-rw-r--r--src/nxt_lib.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/nxt_lib.c b/src/nxt_lib.c
index ee36c91a..d113bcbb 100644
--- a/src/nxt_lib.c
+++ b/src/nxt_lib.c
@@ -36,7 +36,7 @@ nxt_lib_start(const char *app, char **argv, char ***envp)
int n;
nxt_int_t flags;
nxt_bool_t update;
- nxt_thread_t *thr;
+ nxt_thread_t *thread;
flags = nxt_stderr_start();
@@ -64,16 +64,15 @@ nxt_lib_start(const char *app, char **argv, char ***envp)
/* Thread log is required for nxt_malloc() in nxt_strerror_start(). */
nxt_thread_init_data(nxt_thread_context);
- thr = nxt_thread();
- thr->log = &nxt_main_log;
+ thread = nxt_thread();
+ thread->log = &nxt_main_log;
-#if (NXT_THREADS)
- thr->handle = nxt_thread_handle();
- thr->time.signal = -1;
-#endif
+ thread->handle = nxt_thread_handle();
+ thread->time.signal = -1;
+ nxt_thread_time_update(thread);
- nxt_main_task.thread = thr;
- nxt_main_task.log = thr->log;
+ nxt_main_task.thread = thread;
+ nxt_main_task.log = thread->log;
nxt_main_task.ident = nxt_task_next_ident();
if (nxt_strerror_start() != NXT_OK) {
@@ -81,7 +80,7 @@ nxt_lib_start(const char *app, char **argv, char ***envp)
}
if (flags != -1) {
- nxt_log_debug(thr->log, "stderr flags: 0x%04Xd", flags);
+ nxt_debug(&nxt_main_task, "stderr flags: 0x%04Xd", flags);
}
#ifdef _SC_NPROCESSORS_ONLN
@@ -93,7 +92,7 @@ nxt_lib_start(const char *app, char **argv, char ***envp)
#endif
- nxt_log_debug(thr->log, "ncpu: %ui", n);
+ nxt_debug(&nxt_main_task, "ncpu: %ui", n);
if (n > 1) {
nxt_ncpu = n;
@@ -105,12 +104,12 @@ nxt_lib_start(const char *app, char **argv, char ***envp)
nxt_pagesize = getpagesize();
- nxt_log_debug(thr->log, "pagesize: %ui", nxt_pagesize);
+ nxt_debug(&nxt_main_task, "pagesize: %ui", nxt_pagesize);
if (argv != NULL) {
update = (argv[0] == app);
- nxt_process_arguments(argv, envp);
+ nxt_process_arguments(&nxt_main_task, argv, envp);
if (update) {
nxt_log_start(nxt_process_argv[0]);
@@ -131,12 +130,12 @@ nxt_lib_stop(void)
for ( ;; ) {
nxt_thread_pool_t *tp;
- nxt_thread_spin_lock(&cycle->lock);
+ nxt_thread_spin_lock(&rt->lock);
- tp = cycle->thread_pools;
- cycle->thread_pools = (tp != NULL) ? tp->next : NULL;
+ tp = rt->thread_pools;
+ rt->thread_pools = (tp != NULL) ? tp->next : NULL;
- nxt_thread_spin_unlock(&cycle->lock);
+ nxt_thread_spin_unlock(&rt->lock);
if (tp == NULL) {
break;