diff options
Diffstat (limited to '')
-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 \ } \ |