mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-13 14:26:30 -04:00
Tidy up the code in evthread_make_base_notifiable a little
Previously, we had a few conditional statements with the "if (...)" inside an #ifdef and the body outside. That kind of thing is hard to read.
This commit is contained in:
parent
a5bc15b2e1
commit
61e1eeec6f
7
event.c
7
event.c
@ -2564,16 +2564,15 @@ evthread_make_base_notifiable(struct event_base *base)
|
|||||||
if (base->th_notify_fd[0] >= 0) {
|
if (base->th_notify_fd[0] >= 0) {
|
||||||
notify = evthread_notify_base_eventfd;
|
notify = evthread_notify_base_eventfd;
|
||||||
cb = evthread_notify_drain_eventfd;
|
cb = evthread_notify_drain_eventfd;
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(_EVENT_HAVE_PIPE)
|
#if defined(_EVENT_HAVE_PIPE)
|
||||||
{
|
if (base->th_notify_fd[0] < 0) {
|
||||||
if ((base->evsel->features & EV_FEATURE_FDS)) {
|
if ((base->evsel->features & EV_FEATURE_FDS)) {
|
||||||
if (pipe(base->th_notify_fd) < 0)
|
if (pipe(base->th_notify_fd) < 0)
|
||||||
event_warn("%s: pipe", __func__);
|
event_warn("%s: pipe", __func__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (base->th_notify_fd[0] < 0)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -2581,7 +2580,7 @@ evthread_make_base_notifiable(struct event_base *base)
|
|||||||
#else
|
#else
|
||||||
#define LOCAL_SOCKETPAIR_AF AF_UNIX
|
#define LOCAL_SOCKETPAIR_AF AF_UNIX
|
||||||
#endif
|
#endif
|
||||||
{
|
if (base->th_notify_fd[0] < 0) {
|
||||||
if (evutil_socketpair(LOCAL_SOCKETPAIR_AF, SOCK_STREAM, 0,
|
if (evutil_socketpair(LOCAL_SOCKETPAIR_AF, SOCK_STREAM, 0,
|
||||||
base->th_notify_fd) == -1) {
|
base->th_notify_fd) == -1) {
|
||||||
event_sock_warn(-1, "%s: socketpair", __func__);
|
event_sock_warn(-1, "%s: socketpair", __func__);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user