summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_runtime.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-07-18 00:21:16 +0300
committerMax Romanov <max.romanov@nginx.com>2017-07-18 00:21:16 +0300
commit803855138c3b714c088e42a32e80939a81785944 (patch)
treef19efadd82ecfb2aa42f93a1fa67c451ca690724 /src/nxt_runtime.c
parenteb675f2d78178b2cdd54d934022f9b739bfa8952 (diff)
downloadunit-803855138c3b714c088e42a32e80939a81785944.tar.gz
unit-803855138c3b714c088e42a32e80939a81785944.tar.bz2
Mem pool cleanup introduced.
Used for connection mem pool cleanup, which can be used by buffers. Used for port mem pool to safely destroy linked process.
Diffstat (limited to 'src/nxt_runtime.c')
-rw-r--r--src/nxt_runtime.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index 8b216337..31829225 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -1491,6 +1491,8 @@ nxt_runtime_process_new(nxt_runtime_t *rt)
void
nxt_runtime_process_destroy(nxt_runtime_t *rt, nxt_process_t *process)
{
+ nxt_assert(process->port_cleanups == 0);
+
nxt_port_mmaps_destroy(process->incoming, 1);
nxt_port_mmaps_destroy(process->outgoing, 1);
@@ -1657,6 +1659,10 @@ nxt_runtime_process_remove(nxt_runtime_t *rt, nxt_process_t *process)
case NXT_OK:
rt->nprocesses--;
+ if (process->port_cleanups == 0) {
+ nxt_runtime_process_destroy(rt, process);
+ }
+
nxt_process_port_each(process, port) {
nxt_runtime_port_remove(rt, port);
@@ -1665,10 +1671,6 @@ nxt_runtime_process_remove(nxt_runtime_t *rt, nxt_process_t *process)
} nxt_process_port_loop;
- if (nxt_queue_is_empty(&process->ports)) {
- nxt_runtime_process_destroy(rt, process);
- }
-
break;
default: