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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user