diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-07-07 16:01:34 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-07-07 16:01:34 +0300 |
commit | e58f4ef0d030f270c3ef2da7dcb891c961718372 (patch) | |
tree | 3d902bbe55b8edce47e8721edb2cf883bf600e95 /src/nxt_port_memory.c | |
parent | e15b975e9d285f84535c7697f1d87568bfb08269 (diff) | |
download | unit-e58f4ef0d030f270c3ef2da7dcb891c961718372.tar.gz unit-e58f4ef0d030f270c3ef2da7dcb891c961718372.tar.bz2 |
Memory pool thread safety checks in DEBUG build and usage fixes.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_port_memory.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nxt_port_memory.c b/src/nxt_port_memory.c index cf69a758..6aaff5cf 100644 --- a/src/nxt_port_memory.c +++ b/src/nxt_port_memory.c @@ -103,7 +103,8 @@ nxt_port_incoming_port_mmap(nxt_task_t *task, nxt_process_t *process, nxt_thread_mutex_lock(&process->incoming_mutex); if (process->incoming == NULL) { - process->incoming = nxt_array_create(process->mem_pool, 1, + process->incoming_mp = nxt_mp_create(1024, 128, 256, 32); + process->incoming = nxt_array_create(process->incoming_mp, 1, sizeof(nxt_port_mmap_t)); } @@ -113,6 +114,8 @@ nxt_port_incoming_port_mmap(nxt_task_t *task, nxt_process_t *process, goto fail; } + nxt_mp_thread_adopt(process->incoming_mp); + port_mmap = nxt_array_zero_add(process->incoming); if (nxt_slow_path(port_mmap == NULL)) { nxt_log(task, NXT_LOG_WARN, "failed to add mmap to incoming array"); @@ -192,7 +195,8 @@ nxt_port_new_port_mmap(nxt_task_t *task, nxt_process_t *process, port_mmap = NULL; if (process->outgoing == NULL) { - process->outgoing = nxt_array_create(process->mem_pool, 1, + process->outgoing_mp = nxt_mp_create(1024, 128, 256, 32); + process->outgoing = nxt_array_create(process->outgoing_mp, 1, sizeof(nxt_port_mmap_t)); } @@ -202,6 +206,8 @@ nxt_port_new_port_mmap(nxt_task_t *task, nxt_process_t *process, return NULL; } + nxt_mp_thread_adopt(process->outgoing_mp); + port_mmap = nxt_array_zero_add(process->outgoing); if (nxt_slow_path(port_mmap == NULL)) { nxt_log(task, NXT_LOG_WARN, |