码迷,mamicode.com
首页 > 其他好文 > 详细

libevent(十二)信号事件

时间:2017-05-25 22:06:26      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:tar   use   max   inf   log   成员   pair   action   sel   

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(十二)信号事件

标签:tar   use   max   inf   log   成员   pair   action   sel   

原文地址:http://www.cnblogs.com/gattaca/p/6905849.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!