Chinaunix首页 | 论坛 | 博客
  • 博客访问: 213324
  • 博文数量: 40
  • 博客积分: 316
  • 博客等级: 二等列兵
  • 技术积分: 840
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-13 12:39
文章分类

全部博文(40)

文章存档

2014年(2)

2013年(28)

2012年(10)

分类: C/C++

2013-09-16 18:30:23

ngx_module_t 结构体作为所有模块的通用接口 ,只定义了 init_master, init_module, init_process, init_thread, exit_thread, exit_process, exti_master 这7个回调方法。


ngx_core_module, ngx_errlog_module, ngx_events_module, ngx_openssl_module, ngx_http_module, ngx_mail_module  6个核心模块。类 型:NGX_CORE_MODULE.


ngx_conf_module 配置模块。类型:NGX_CONF_MODULE.

ngx_cycle_t   nginx框架的核心结构体.

ngx_listening_t  //ngx_cycle_t 对象中有一个动态数组成员listening,每个数组元素都是ngx_listening_t 结构体。

------------------------------------------------
accept_mutex   nginx的负载均衡锁。
------------------------------------------------
1.事件模块:
ngx_module_t->ctx  => ngx_event_module_t  事件模块通用接口。
ngx_event_module_t.action => ngx_event_action_t   事件模块的10个抽象方法。
struct  ngx_event_t 表示每个事件。
nginx不需要创建事件, 在启动时,在ngx_cycle_t 结构中的 read_events 和 write_events
分配了所有的读写事件。
ngx_handle_read_event, ngx_handle_write_event 添加读写事件。

ngx_connection_t  被动连接的结构体。
ngx_peer_connection_t  主动连接的结构体。   //这2种结构体不能随意创建,需从连接池中取。
ngx_cycle_t 结构中的connection /*(指向连接池首部)*/ 和 free_connection/*(指向第一个ngx_connection_t空闲连接)*/ 构建了一个连接池。
ngx_get_connection,ngx_free_connection 获取和释放连接池。

ngx_event_get_conf(conf_ctx, module) 此宏获得事件模块的配置项。

阅读(1812) | 评论(0) | 转发(0) |
0

上一篇:linux内核参数

下一篇:LD_PRELOAD环境变量

给主人留下些什么吧!~~