summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_main_process.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-10-04 15:02:11 +0300
committerMax Romanov <max.romanov@nginx.com>2017-10-04 15:02:11 +0300
commite44401a0bb72aa66bec0322fa05e8c86fefc9074 (patch)
treef5a7013e7d811f13515ed7bfc9dc96ff7c6729d6 /src/nxt_main_process.c
parentf869bf1b020ed41d5a64b106ba48ec45412b912c (diff)
downloadunit-e44401a0bb72aa66bec0322fa05e8c86fefc9074.tar.gz
unit-e44401a0bb72aa66bec0322fa05e8c86fefc9074.tar.bz2
Introducing process use counter.
This helps to decouple process removal from port memory pool cleanups.
Diffstat (limited to '')
-rw-r--r--src/nxt_main_process.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index 9c27a89b..128c0fde 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -257,11 +257,14 @@ nxt_main_process_port_create(nxt_task_t *task, nxt_runtime_t *rt)
port = nxt_port_new(task, 0, nxt_pid, NXT_PROCESS_MAIN);
if (nxt_slow_path(port == NULL)) {
+ nxt_process_use(task, process, -1);
return NXT_ERROR;
}
nxt_process_port_add(task, process, port);
+ nxt_process_use(task, process, -1);
+
ret = nxt_port_socket_init(task, port, 0);
if (nxt_slow_path(ret != NXT_OK)) {
nxt_port_use(task, port, -1);
@@ -511,12 +514,14 @@ nxt_main_create_worker_process(nxt_task_t *task, nxt_runtime_t *rt,
port = nxt_port_new(task, 0, 0, init->type);
if (nxt_slow_path(port == NULL)) {
- nxt_runtime_process_remove(task, process);
+ nxt_process_use(task, process, -1);
return NXT_ERROR;
}
nxt_process_port_add(task, process, port);
+ nxt_process_use(task, process, -1);
+
ret = nxt_port_socket_init(task, port, 0);
if (nxt_slow_path(ret != NXT_OK)) {
nxt_port_use(task, port, -1);
@@ -760,7 +765,7 @@ nxt_main_cleanup_worker_process(nxt_task_t *task, nxt_pid_t pid)
if (process) {
init = process->init;
- nxt_runtime_process_remove(task, process);
+ nxt_process_close_ports(task, process);
if (!nxt_exiting) {
nxt_runtime_process_each(rt, process) {