Fix leaked eventfd in PosixEventDriverCore.

The leak occurred once per thread, which showed up in conjunction with DNS lookups in particular, as a thread is currently created for each lookup.
This commit is contained in:
Sönke Ludwig 2018-03-14 21:58:48 +01:00
parent 0044946413
commit b6b32f4a49

View file

@ -92,6 +92,7 @@ final class PosixEventDriver(Loop : PosixEventLoop) : EventDriver {
if (!m_loop) return; if (!m_loop) return;
m_files.dispose(); m_files.dispose();
m_dns.dispose(); m_dns.dispose();
m_core.dispose();
m_loop.dispose(); m_loop.dispose();
m_loop = null; m_loop = null;
} }
@ -120,6 +121,12 @@ final class PosixEventDriverCore(Loop : PosixEventLoop, Timers : EventDriverTime
m_wakeupEvent = events.createInternal(); m_wakeupEvent = events.createInternal();
} }
protected final void dispose()
{
m_events.releaseRef(m_wakeupEvent);
m_wakeupEvent = EventID.invalid;
}
@property size_t waiterCount() const { return m_loop.m_waiterCount + m_timers.pendingCount; } @property size_t waiterCount() const { return m_loop.m_waiterCount + m_timers.pendingCount; }
final override ExitReason processEvents(Duration timeout) final override ExitReason processEvents(Duration timeout)