Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis of event module initialization source code of nginx

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "nginx event module initialization source code analysis". In daily operation, I believe that many people have doubts about nginx event module initialization source code analysis. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "nginx event module initialization source code analysis". Next, please follow the editor to study!

Let's take a look at the code for the create_conf functions of each module.

This is the create_conf function of the ngx_event_core_module module.

/ / create a structure to store the event module configuration

Static void * ngx_event_create_conf (ngx_cycle_t * cycle)

{

Ngx_event_conf_t * ecf

Ngx_test_null (ecf, ngx_palloc (cycle- > pool, sizeof (ngx_event_conf_t))

NGX_CONF_ERROR)

Ecf- > connections = NGX_CONF_UNSET_UINT

Ecf- > use = NGX_CONF_UNSET_UINT

Ecf- > multi_accept = NGX_CONF_UNSET

Ecf- > accept_mutex = NGX_CONF_UNSET

Ecf- > accept_mutex_delay = NGX_CONF_UNSET_MSEC

Ecf- > name = (void *) NGX_CONF_UNSET

# if (NGX_DEBUG)

Ngx_init_array (ecf- > debug_connection, cycle- > pool, 5, sizeof (in_addr_t))

NGX_CONF_ERROR)

# endif

Return ecf

}

The remaining eventful submodules are event-driven, and the create_conf function of epoll is as follows.

Static void * ngx_epoll_create_conf (ngx_cycle_t * cycle)

{

Ngx_epoll_conf_t * epcf

Ngx_test_null (epcf, ngx_palloc (cycle- > pool, sizeof (ngx_epoll_conf_t))

NGX_CONF_ERROR)

Epcf- > events = NGX_CONF_UNSET

Return epcf

}

Kqueue's are as follows.

Static void * ngx_kqueue_create_conf (ngx_cycle_t * cycle)

{

Ngx_kqueue_conf_t * kcf

Ngx_test_null (kcf, ngx_palloc (cycle- > pool, sizeof (ngx_kqueue_conf_t))

NGX_CONF_ERROR)

Kcf- > changes = NGX_CONF_UNSET

Kcf- > events = NGX_CONF_UNSET

Return kcf

}

Some sub-modules do not implement the create_conf function, after the create_conf function of all modules is executed.

At this point, on the "nginx event module initialization source code analysis" on the end of the study, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report