diff --git a/sources/network/windows/io_service.cpp b/sources/network/windows/io_service.cpp index 300ec29..760eb48 100644 --- a/sources/network/windows/io_service.cpp +++ b/sources/network/windows/io_service.cpp @@ -87,8 +87,16 @@ io_service::poll(void) { while (!m_should_stop) { int ndfs = init_poll_fds_info(); + //! setup timeout + struct timeval* timeout_ptr = NULL; +#ifdef __TACOPIE_TIMEOUT + struct timeval timeout; + timeout.tv_usec = __TACOPIE_TIMEOUT; + timeout_ptr = &timeout; +#endif /* __TACOPIE_TIMEOUT */ + __TACOPIE_LOG(debug, "polling fds"); - if (select(ndfs, &m_rd_set, &m_wr_set, NULL, NULL) > 0) { process_events(); } + if (select(ndfs, &m_rd_set, &m_wr_set, NULL, timeout_ptr) > 0) { process_events(); } else { __TACOPIE_LOG(debug, "poll woke up, but nothing to process"); } @@ -155,8 +163,6 @@ io_service::process_rd_event(const fd_t& fd, tracked_socket& socket) { m_tracked_sockets.erase(it); m_wait_for_removal_condvar.notify_all(); } - - m_notifier.notify(); }; } @@ -185,8 +191,6 @@ io_service::process_wr_event(const fd_t& fd, tracked_socket& socket) { m_tracked_sockets.erase(it); m_wait_for_removal_condvar.notify_all(); } - - m_notifier.notify(); }; } @@ -301,4 +305,4 @@ io_service::wait_for_removal(const tcp_socket& socket) { }); } -} //! tacopie +} // namespace tacopie