Avoid a spurious close(-1) on Linux

On Linux, we use only one fd to do main-thread signaling (since we have
eventfd()), so we don't need to close th_notify_fd[1] as we would if we were
using a socketpair.
This commit is contained in:
Nick Mathewson 2010-03-12 18:35:15 -05:00
parent 75018951ec
commit 70a44b61bb

View File

@ -648,7 +648,8 @@ event_base_free(struct event_base *base)
if (base->th_notify_fd[0] != -1) { if (base->th_notify_fd[0] != -1) {
event_del(&base->th_notify); event_del(&base->th_notify);
EVUTIL_CLOSESOCKET(base->th_notify_fd[0]); EVUTIL_CLOSESOCKET(base->th_notify_fd[0]);
EVUTIL_CLOSESOCKET(base->th_notify_fd[1]); if (base->th_notify_fd[1] != -1)
EVUTIL_CLOSESOCKET(base->th_notify_fd[1]);
base->th_notify_fd[0] = -1; base->th_notify_fd[0] = -1;
base->th_notify_fd[1] = -1; base->th_notify_fd[1] = -1;
event_debug_unassign(&base->th_notify); event_debug_unassign(&base->th_notify);