概述在 nginx 初始化流程的介绍中,我们已经看到 nginx module 是怎么初始化和加载的,nginx module 提供了抽象的接口,由各个实际的模块实现者去实现相应的接口,当然,事件模块也是如此 EPOLL 模块 module 定义// struct ngx_event_module_t
// 事件模块结构体 {{{
typedef struct {
// 模块名称
ngx_str_t *name;
// 解析配置前,用于创建存储配置项参数结构体的回调函数
void *(*create_conf)(ngx_cycle_t *cycle);
// 解析配置完成后,用于综合处理某些配置项
char *(*init_conf)(ngx_cycle_t *cycle, void *conf);
// 对于事件驱动机制,每个事件需要实现的 10 个抽象方法
ngx_event_actions_t actions;
} ngx_event_module_t; // }}} 在事件模块结构体的最后定义了