mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 13:58:58 -04:00
make kqueue signal callback work with sigchld. cast and better timeout.
svn:r27
This commit is contained in:
parent
484e594e5c
commit
3821c7e201
2
event.h
2
event.h
@ -112,7 +112,7 @@ struct eventop {
|
||||
int (*dispatch)(void *, struct timeval *);
|
||||
};
|
||||
|
||||
#define TIMEOUT_DEFAULT {0, 250000L}
|
||||
#define TIMEOUT_DEFAULT {5, 0}
|
||||
|
||||
void event_init(void);
|
||||
int event_dispatch(void);
|
||||
|
10
kqueue.c
10
kqueue.c
@ -164,6 +164,12 @@ kq_insert(struct kqop *kqop, struct kevent *kev)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
kq_sighandler(int sig)
|
||||
{
|
||||
/* Do nothing here */
|
||||
}
|
||||
|
||||
int
|
||||
kq_dispatch(void *arg, struct timeval *tv)
|
||||
{
|
||||
@ -275,7 +281,7 @@ kq_add(void *arg, struct event *ev)
|
||||
if (kq_insert(kqop, &kev) == -1)
|
||||
return (-1);
|
||||
|
||||
if (signal(nsignal, SIG_IGN) == SIG_ERR)
|
||||
if (signal(nsignal, kq_sighandler) == SIG_ERR)
|
||||
return (-1);
|
||||
|
||||
ev->ev_flags |= EVLIST_X_KQINKERNEL;
|
||||
@ -324,7 +330,7 @@ kq_del(void *arg, struct event *ev)
|
||||
int nsignal = EVENT_SIGNAL(ev);
|
||||
|
||||
memset(&kev, 0, sizeof(kev));
|
||||
kev.ident = signal;
|
||||
kev.ident = (int)signal;
|
||||
kev.filter = EVFILT_SIGNAL;
|
||||
kev.flags = EV_DELETE;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user