Explicitly dispose the event driver on thread shutdown.
Handle multiple calls to dispose() gracefully, because external code may already make an explicit call to dispose().
This commit is contained in:
parent
1cadc3077b
commit
aa9a08f571
|
@ -30,6 +30,11 @@ static if (!is(NativeEventDriver == EventDriver)) {
|
|||
if (!s_driver) s_driver = new NativeEventDriver;
|
||||
}
|
||||
|
||||
static ~this()
|
||||
{
|
||||
s_driver.dispose();
|
||||
}
|
||||
|
||||
shared static this()
|
||||
{
|
||||
s_driver = new NativeEventDriver;
|
||||
|
|
|
@ -89,9 +89,11 @@ final class PosixEventDriver(Loop : PosixEventLoop) : EventDriver {
|
|||
|
||||
final override void dispose()
|
||||
{
|
||||
if (!m_loop) return;
|
||||
m_files.dispose();
|
||||
m_dns.dispose();
|
||||
m_loop.dispose();
|
||||
m_loop = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,9 @@ final class WinAPIEventDriver : EventDriver {
|
|||
|
||||
override void dispose()
|
||||
{
|
||||
if (!m_events) return;
|
||||
m_events.dispose();
|
||||
m_events = null;
|
||||
assert(threadInstance !is null);
|
||||
threadInstance = null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue