以下为Nginx进程部分源码初步分析,只有函数的调用框架,更详细的分析将在以后给出,这部分内容是配合进程间通信源码的部分学习所记下的笔记。
注1:
#define ngx_process_events ngx_event_actions.process_events
typedef struct {
ngx_int_t (*add)(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags);
ngx_int_t (*del)(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags);
ngx_int_t (*enable)(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags);
ngx_int_t (*disable)(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags);
ngx_int_t (*add_conn)(ngx_connection_t *c);
ngx_int_t (*del_conn)(ngx_connection_t *c, ngx_uint_t flags);
ngx_int_t (*process_changes)(ngx_cycle_t *cycle, ngx_uint_t nowait);
ngx_int_t (*process_events)(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_uint_t flags);
ngx_int_t (*init)(ngx_cycle_t *cycle, ngx_msec_t timer);
void (*done)(ngx_cycle_t *cycle);
} ngx_event_actions_t;
注2:此部分为父子进程和兄弟间进程通信所设置,但是Nginx并没有使用该功能,因为该功能使用的是socket通信,而Nginx选择了效率更高的共享内存的方式来进行进程间的通信。