diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-07-07 16:01:34 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-07-07 16:01:34 +0300 |
commit | 74cda90e31f97ba0ebd6483f2b073c1240b93a58 (patch) | |
tree | 69727640f476822e3cc1e40ac09bf645251617be /src/nxt_runtime.h | |
parent | 61008a7c0b45fe55f3f611c61f81e569e6baee30 (diff) | |
download | unit-74cda90e31f97ba0ebd6483f2b073c1240b93a58.tar.gz unit-74cda90e31f97ba0ebd6483f2b073c1240b93a58.tar.bz2 |
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.
Diffstat (limited to 'src/nxt_runtime.h')
-rw-r--r-- | src/nxt_runtime.h | 21 |
1 files changed, 19 insertions, 2 deletions
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 \ } \ |