From 74cda90e31f97ba0ebd6483f2b073c1240b93a58 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Fri, 7 Jul 2017 16:01:34 +0300 Subject: Process stop notification from master to all other processes. New port message type introduced NXT_PORT_MSG_REMOVE_PID. Default handler removes process description from nxt_runtime_t with all ports, incoming and outgoing mmaps etc. --- src/nxt_runtime.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/nxt_runtime.h') diff --git a/src/nxt_runtime.h b/src/nxt_runtime.h index 8316d1e3..46e8e9d2 100644 --- a/src/nxt_runtime.h +++ b/src/nxt_runtime.h @@ -45,7 +45,7 @@ struct nxt_runtime_s { uint32_t last_engine_id; - nxt_process_type_t type; + uint32_t types; /* bitset of nxt_process_type_t */ nxt_timer_t timer; @@ -84,6 +84,20 @@ nxt_int_t nxt_runtime_thread_pool_create(nxt_thread_t *thr, nxt_runtime_t *rt, #endif +nxt_inline nxt_bool_t +nxt_runtime_is_type(nxt_runtime_t *rt, nxt_process_type_t type) +{ + return (rt->types & (1U << type)) != 0; +} + + +nxt_inline nxt_bool_t +nxt_runtime_is_master(nxt_runtime_t *rt) +{ + return nxt_runtime_is_type(rt, NXT_PROCESS_MASTER); +} + + nxt_process_t *nxt_runtime_process_new(nxt_runtime_t *rt); nxt_process_t *nxt_runtime_process_get(nxt_runtime_t *rt, nxt_pid_t pid); @@ -141,10 +155,13 @@ void nxt_port_app_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg); #define nxt_runtime_process_each(rt, process) \ do { \ nxt_lvlhsh_each_t _lhe; \ + nxt_process_t *_nxt; \ \ for (process = nxt_runtime_process_first(rt, &_lhe); \ process != NULL; \ - process = nxt_runtime_process_next(rt, &_lhe)) { \ + process = _nxt) { \ + \ + _nxt = nxt_runtime_process_next(rt, &_lhe); \ #define nxt_runtime_process_loop \ } \ -- cgit