ngx_event_block 函数解析
来源:互联网 发布:4y4淘宝装修助手 编辑:程序博客网 时间:2024/05/25 23:26
static char *ngx_events_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf){ char *rv; void ***ctx; ngx_uint_t i; ngx_conf_t pcf; ngx_event_module_t *m; if (*(void **) conf) { return "is duplicate"; } /* count the number of the event modules and set up their indices */ //初始化所有event_module模块的ctx_index序号 ngx_event_max_module = 0; for (i = 0; ngx_modules[i]; i++) { if (ngx_modules[i]->type != NGX_EVENT_MODULE) { continue; } ngx_modules[i]->ctx_index = ngx_event_max_module++; } ctx = ngx_pcalloc(cf->pool, sizeof(void *)); if (ctx == NULL) { return NGX_CONF_ERROR; } *ctx = ngx_pcalloc(cf->pool, ngx_event_max_module * sizeof(void *)); if (*ctx == NULL) { return NGX_CONF_ERROR; } *(void **) conf = ctx;//调用每个event_module的create_conf函数 for (i = 0; ngx_modules[i]; i++) { if (ngx_modules[i]->type != NGX_EVENT_MODULE) { continue; } m = ngx_modules[i]->ctx; if (m->create_conf) { (*ctx)[ngx_modules[i]->ctx_index] = m->create_conf(cf->cycle); if ((*ctx)[ngx_modules[i]->ctx_index] == NULL) { return NGX_CONF_ERROR; } } } pcf = *cf; cf->ctx = ctx; cf->module_type = NGX_EVENT_MODULE; cf->cmd_type = NGX_EVENT_CONF; //为每个子模块解析配置文件. rv = ngx_conf_parse(cf, NULL); *cf = pcf; if (rv != NGX_CONF_OK) return rv;//为每个事件模块调用init_conf for (i = 0; ngx_modules[i]; i++) { if (ngx_modules[i]->type != NGX_EVENT_MODULE) { continue; } m = ngx_modules[i]->ctx; if (m->init_conf) { rv = m->init_conf(cf->cycle, (*ctx)[ngx_modules[i]->ctx_index]); if (rv != NGX_CONF_OK) { return rv; } } } return NGX_CONF_OK;}
0 0
- ngx_event_block 函数解析
- 函数调用约定解析
- 函数解析字符串(ZT)
- setsockopt函数解析(转)
- ARX函数解析
- 成员函数重载解析
- js 函数深入解析
- Linux wait函数解析
- 函数调用约定解析
- 钩子函数解析
- 虚函数解析
- 函数表达式解析器
- PartitionMotionSearch()函数解析
- fcntl函数解析
- main函数参数解析
- json解析函数。
- 虚函数详细解析
- 虚析构函数解析
- sql
- OJ返回的结果分别是什么意思
- cocos2dx win32移植到xcode
- java中常见的知识点1
- 线索二叉树
- ngx_event_block 函数解析
- 这一年以来读过的书(2013)
- Thinkpad T61升级记:64位操作系统win7_x64,8G内存
- 基于感知哈希算法的视觉目标跟踪
- Oracle数据库的用户管理
- ASE15.7 ESD#2不再支持WinXP专业版了
- 斐波那契查找算法分析
- 总结Linux压缩解压的所有命令
- Longest Consecutive Sequence