Libunit: added a function to discern main and worker contexts.
This commit is contained in:
@@ -4854,6 +4854,17 @@ nxt_unit_run_shared(nxt_unit_ctx_t *ctx)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nxt_unit_is_main_ctx(nxt_unit_ctx_t *ctx)
|
||||
{
|
||||
nxt_unit_impl_t *lib;
|
||||
|
||||
lib = nxt_container_of(ctx->unit, nxt_unit_impl_t, unit);
|
||||
|
||||
return (ctx == &lib->main_ctx.ctx);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nxt_unit_process_port_msg(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port)
|
||||
{
|
||||
|
||||
@@ -210,6 +210,8 @@ int nxt_unit_run_ctx(nxt_unit_ctx_t *ctx);
|
||||
|
||||
int nxt_unit_run_shared(nxt_unit_ctx_t *ctx);
|
||||
|
||||
int nxt_unit_is_main_ctx(nxt_unit_ctx_t *ctx);
|
||||
|
||||
/*
|
||||
* Receive and process one message, invoke configured callbacks.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user