From 6532e46465276efcedae299ce290eb8dff0ece57 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Thu, 19 Oct 2017 17:36:56 +0300 Subject: Supporting concurrent shared memory fd receive in router. Two different router threads may send different requests to single application worker. In this case shared memory fds from worker to router will be send over 2 different router ports. These fds will be received and processed by different threads in any order. This patch made possible to add incoming shared memory segments in arbitrary order. Additionally, array and memory pool are no longer used to store segments because of pool's single threaded nature. Custom array-like structure nxt_port_mmaps_t introduced. --- src/nxt_runtime.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/nxt_runtime.c') diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c index 8fc2bc53..60ce45f6 100644 --- a/src/nxt_runtime.c +++ b/src/nxt_runtime.c @@ -1576,8 +1576,8 @@ nxt_runtime_process_new(nxt_runtime_t *rt) nxt_queue_init(&process->ports); - nxt_thread_mutex_create(&process->incoming_mutex); - nxt_thread_mutex_create(&process->outgoing_mutex); + nxt_thread_mutex_create(&process->incoming.mutex); + nxt_thread_mutex_create(&process->outgoing.mutex); nxt_thread_mutex_create(&process->cp_mutex); process->use_count = 1; @@ -1595,8 +1595,8 @@ nxt_runtime_process_destroy(nxt_runtime_t *rt, nxt_process_t *process) nxt_assert(process->use_count == 0); nxt_assert(process->registered == 0); - nxt_port_mmaps_destroy(process->incoming, 1); - nxt_port_mmaps_destroy(process->outgoing, 1); + nxt_port_mmaps_destroy(&process->incoming, 1); + nxt_port_mmaps_destroy(&process->outgoing, 1); port = nxt_port_hash_first(&process->connected_ports, &lhe); @@ -1606,8 +1606,8 @@ nxt_runtime_process_destroy(nxt_runtime_t *rt, nxt_process_t *process) port = nxt_port_hash_first(&process->connected_ports, &lhe); } - nxt_thread_mutex_destroy(&process->incoming_mutex); - nxt_thread_mutex_destroy(&process->outgoing_mutex); + nxt_thread_mutex_destroy(&process->incoming.mutex); + nxt_thread_mutex_destroy(&process->outgoing.mutex); nxt_thread_mutex_destroy(&process->cp_mutex); nxt_mp_free(rt->mem_pool, process); -- cgit