首页 > 代码库 > libevent(十二)信号事件
libevent(十二)信号事件
libevent通过socketpair实现对信号事件的监听。
event_base结构体有个成员sig,结构如下:
struct evsig_info { /* Event watching ev_signal_pair[1] */ struct event ev_signal; /* Socketpair used to send notifications from the signal handler */ evutil_socket_t ev_signal_pair[2]; /* True iff we‘ve added the ev_signal event yet. */ int ev_signal_added; /* Count of the number of signals we‘re currently watching. */ int ev_n_signals_added; /* Array of previous signal handler objects before Libevent started * messing with them. Used to restore old signal handlers. */ #ifdef _EVENT_HAVE_SIGACTION struct sigaction **sh_old; #else ev_sighandler_t **sh_old; #endif /* Size of sh_old. */ int sh_old_max; };
event_base还有个成员evsigsel,用来描述信号处理的底层逻辑,
libevent(十二)信号事件
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。