diff options
Diffstat (limited to '')
-rw-r--r-- | src/nxt_port_hash.c | 8 | ||||
-rw-r--r-- | src/nxt_port_hash.h | 6 | ||||
-rw-r--r-- | src/nxt_runtime.c | 12 |
3 files changed, 7 insertions, 19 deletions
diff --git a/src/nxt_port_hash.c b/src/nxt_port_hash.c index 6361f220..b23acfb2 100644 --- a/src/nxt_port_hash.c +++ b/src/nxt_port_hash.c @@ -42,13 +42,9 @@ static const nxt_lvlhsh_proto_t lvlhsh_ports_proto nxt_aligned(64) = { nxt_port_t * -nxt_port_hash_first(nxt_lvlhsh_t *port_hash, nxt_lvlhsh_each_t *lhe) +nxt_port_hash_retrieve(nxt_lvlhsh_t *port_hash) { - nxt_memzero(lhe, sizeof(nxt_lvlhsh_each_t)); - - lhe->proto = &lvlhsh_ports_proto; - - return nxt_port_hash_next(port_hash, lhe); + return nxt_lvlhsh_retrieve(port_hash, &lvlhsh_ports_proto, NULL); } diff --git a/src/nxt_port_hash.h b/src/nxt_port_hash.h index 97266fac..c975cab7 100644 --- a/src/nxt_port_hash.h +++ b/src/nxt_port_hash.h @@ -18,11 +18,7 @@ nxt_int_t nxt_port_hash_remove(nxt_lvlhsh_t *port_hash, nxt_port_t *port); nxt_port_t *nxt_port_hash_find(nxt_lvlhsh_t *port_hash, nxt_pid_t pid, nxt_port_id_t port_id); -nxt_port_t *nxt_port_hash_first(nxt_lvlhsh_t *port_hash, - nxt_lvlhsh_each_t *lhe); - -#define nxt_port_hash_next(port_hash, lhe) \ - nxt_lvlhsh_each((port_hash), (lhe)) +nxt_port_t *nxt_port_hash_retrieve(nxt_lvlhsh_t *port_hash); #endif /* _NXT_PORT_HASH_H_INCLIDED_ */ diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c index d4f19dbf..a72bf945 100644 --- a/src/nxt_runtime.c +++ b/src/nxt_runtime.c @@ -1585,8 +1585,7 @@ nxt_runtime_process_new(nxt_runtime_t *rt) static void nxt_runtime_process_destroy(nxt_runtime_t *rt, nxt_process_t *process) { - nxt_port_t *port; - nxt_lvlhsh_each_t lhe; + nxt_port_t *port; nxt_assert(process->use_count == 0); nxt_assert(process->registered == 0); @@ -1594,13 +1593,10 @@ nxt_runtime_process_destroy(nxt_runtime_t *rt, nxt_process_t *process) nxt_port_mmaps_destroy(&process->incoming, 1); nxt_port_mmaps_destroy(&process->outgoing, 1); - port = nxt_port_hash_first(&process->connected_ports, &lhe); - - while(port != NULL) { - nxt_port_hash_remove(&process->connected_ports, port); + do { + port = nxt_port_hash_retrieve(&process->connected_ports); - port = nxt_port_hash_first(&process->connected_ports, &lhe); - } + } while (port != NULL); nxt_thread_mutex_destroy(&process->incoming.mutex); nxt_thread_mutex_destroy(&process->outgoing.mutex); |