From 031ed91ea61ad750485c4e0e4e211097a34f80e8 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 27 Oct 2012 15:15:34 +0200 Subject: [PATCH] EventManager: handle forced events even when poll return -1 --- src/event_manager.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/event_manager.cc b/src/event_manager.cc index daa363f7..12b23f7e 100644 --- a/src/event_manager.cc +++ b/src/event_manager.cc @@ -35,15 +35,13 @@ void EventManager::handle_next_events() { const int timeout_ms = 100; int res = poll(m_events.data(), m_events.size(), timeout_ms); - if (res >= 0) + for (size_t i = 0; i < m_events.size(); ++i) { - for (size_t i = 0; i < m_events.size(); ++i) - { - if (m_events[i].revents or contains(m_forced, m_events[i].fd)) - m_handlers[i](m_events[i].fd); - } - m_forced.clear(); + if ((res > 0 and m_events[i].revents) or + contains(m_forced, m_events[i].fd)) + m_handlers[i](m_events[i].fd); } + m_forced.clear(); } void EventManager::force_signal(int fd)