Skip to content

The init and exit cycle hooks in application layer

Taymindis Woon edited this page Dec 23, 2018 · 7 revisions

There are 2 functions must have built into your application layer, there extending the function of worker cycle init and exit of your applications.

void ngx_link_func_init_cycle(ngx_link_func_cycle_t* cyc);
void ngx_link_func_exit_cycle(ngx_link_func_cycle_t* cyc);

ngx_link_func_init_cycle and ngx_link_func_exit_cycle will be triggered N times of your application. The N is the number of your worker process defined in your nginx.

This is very important when you are workaround with link function shared memory, link function shared memory is reusable no matter how many time you reload the nginx. Once the nginx stopped, the link function shared memory will be freed.

The Benefit of cycle hooking, you can prepare your config properties setup and etc, if you have nothing to do in this function, you may just create a empty block function.

Clone this wiki locally