summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_process.h
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-10-19 17:36:56 +0300
committerMax Romanov <max.romanov@nginx.com>2017-10-19 17:36:56 +0300
commit6532e46465276efcedae299ce290eb8dff0ece57 (patch)
tree89c2716d8eb96a9f527b9b87df522fb9e8661f3a /src/nxt_process.h
parent6fd465f9d24040946f4218c281bd82517d5a350c (diff)
downloadunit-6532e46465276efcedae299ce290eb8dff0ece57.tar.gz
unit-6532e46465276efcedae299ce290eb8dff0ece57.tar.bz2
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.
Diffstat (limited to 'src/nxt_process.h')
-rw-r--r--src/nxt_process.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/nxt_process.h b/src/nxt_process.h
index 26e7de18..ae0e1661 100644
--- a/src/nxt_process.h
+++ b/src/nxt_process.h
@@ -42,6 +42,17 @@ struct nxt_process_init_s {
};
+typedef struct nxt_port_mmap_s nxt_port_mmap_t;
+typedef struct nxt_port_mmaps_s nxt_port_mmaps_t;
+
+struct nxt_port_mmaps_s {
+ nxt_thread_mutex_t mutex;
+ uint32_t size;
+ uint32_t cap;
+ nxt_port_mmap_t *elts;
+};
+
+
typedef struct {
nxt_pid_t pid;
nxt_queue_t ports; /* of nxt_port_t */
@@ -51,11 +62,8 @@ typedef struct {
nxt_process_init_t *init;
- nxt_thread_mutex_t incoming_mutex;
- nxt_array_t *incoming; /* of nxt_port_mmap_t */
-
- nxt_thread_mutex_t outgoing_mutex;
- nxt_array_t *outgoing; /* of nxt_port_mmap_t */
+ nxt_port_mmaps_t incoming;
+ nxt_port_mmaps_t outgoing;
nxt_thread_mutex_t cp_mutex;
nxt_lvlhsh_t connected_ports; /* of nxt_port_t */