diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-07-18 00:21:16 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-07-18 00:21:16 +0300 |
commit | 803855138c3b714c088e42a32e80939a81785944 (patch) | |
tree | f19efadd82ecfb2aa42f93a1fa67c451ca690724 /src/nxt_process.c | |
parent | eb675f2d78178b2cdd54d934022f9b739bfa8952 (diff) | |
download | unit-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_process.c')
-rw-r--r-- | src/nxt_process.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/nxt_process.c b/src/nxt_process.c index 1832640d..9561fb84 100644 --- a/src/nxt_process.c +++ b/src/nxt_process.c @@ -563,11 +563,31 @@ nxt_user_cred_set(nxt_task_t *task, nxt_user_cred_t *uc) } +static void +nxt_process_port_mp_cleanup(nxt_task_t *task, void *obj, void *data) +{ + nxt_runtime_t *rt; + nxt_process_t *process; + + process = obj; + rt = data; + + process->port_cleanups--; + + if (process->port_cleanups == 0) { + nxt_runtime_process_destroy(rt, process); + } +} + void -nxt_process_port_add(nxt_process_t *process, nxt_port_t *port) +nxt_process_port_add(nxt_task_t *task, nxt_process_t *process, nxt_port_t *port) { port->process = process; nxt_queue_insert_tail(&process->ports, &port->link); + + nxt_mp_cleanup(port->mem_pool, nxt_process_port_mp_cleanup, task, process, + task->thread->runtime); + process->port_cleanups++; } |