diff --git a/source/eventcore/drivers/epoll.d b/source/eventcore/drivers/epoll.d index 99718a4..baa8d41 100644 --- a/source/eventcore/drivers/epoll.d +++ b/source/eventcore/drivers/epoll.d @@ -34,11 +34,12 @@ final class EpollEventDriver : PosixEventDriver { import std.algorithm : min; //assert(Fiber.getThis() is null, "processEvents may not be called from within a fiber!"); - auto ts = timeout.toTimeVal; - //print("wait %s", m_events.length); - auto ret = epoll_wait(m_epoll, m_events.ptr, cast(int)m_events.length, timeout == Duration.max ? -1 : cast(int)min(timeout.total!"msecs", int.max)); - //print("wait done %s", ret); + long tomsec; + if (timeout == Duration.max) tomsec = long.max; + else tomsec = (timeout.total!"hnsecs" + 9999) / 10_000; + auto ret = epoll_wait(m_epoll, m_events.ptr, cast(int)m_events.length, tomsec > int.max ? -1 : cast(int)tomsec); + print("wait done %s", ret); if (ret > 0) { foreach (ref evt; m_events[0 .. ret]) {