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.
This commit is contained in:
Max Romanov
2017-07-07 16:01:34 +03:00
parent 61008a7c0b
commit 74cda90e31
11 changed files with 113 additions and 22 deletions

View File

@@ -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 \
} \