coming
天行健 君子以自强不息
记录我的成长
event_base结构体
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
struct event_base { const struct eventop *evsel; void *evbase; struct event_changelist changelist; const struct eventop *evsigsel; struct evsig_info sig; int virtual_event_count; int virtual_event_count_max; int event_count; int event_count_max; int event_count_active; int event_count_active_max; int event_gotterm; int event_break; int event_continue; int event_running_priority; int running_loop; int n_deferreds_queued; struct evcallback_list *activequeues; int nactivequeues; struct evcallback_list active_later_queue; struct common_timeout_list **common_timeout_queues; int n_common_timeouts; int n_common_timeouts_allocated; struct event_io_map io; struct event_signal_map sigmap; struct min_heap timeheap; struct timeval tv_cache; struct evutil_monotonic_timer monotonic_timer; struct timeval tv_clock_diff; time_t last_updated_clock_diff; #ifndef EVENT__DISABLE_THREAD_SUPPORT unsigned long th_owner_id; void *th_base_lock; void *current_event_cond; int current_event_waiters; #endif struct event_callback *current_event;
#ifdef _WIN32 struct event_iocp_port *iocp; #endif enum event_base_config_flag flags; struct timeval max_dispatch_time; int max_dispatch_callbacks; int limit_callbacks_after_prio; int is_notify_pending; evutil_socket_t th_notify_fd[2]; struct event th_notify; int (*th_notify_fn)(struct event_base *base); struct evutil_weakrand_state weakrand_seed; LIST_HEAD(once_event_list, event_once) once_events; };
|
事件循环
事件循环由event_base_loop函数实现。关于event_base_loop函数的分析详见代码清单12-10。
本文代表个人观点,内容仅供参考。若有不恰当之处,望不吝赐教!