Fix waiter count bookkeeping in PosixEventDriverEvents.
This commit is contained in:
parent
e5078ad399
commit
d6321a2b52
|
@ -1231,13 +1231,16 @@ final class PosixEventDriverEvents(Loop : PosixEventLoop, Sockets : EventDriverS
|
||||||
//log("emitting only for this thread (%s waiters)", m_fds[event].waiters.length);
|
//log("emitting only for this thread (%s waiters)", m_fds[event].waiters.length);
|
||||||
foreach (w; slot.waiters.consume) {
|
foreach (w; slot.waiters.consume) {
|
||||||
//log("emitting waiter %s %s", cast(void*)w.funcptr, w.ptr);
|
//log("emitting waiter %s %s", cast(void*)w.funcptr, w.ptr);
|
||||||
|
m_loop.m_waiterCount--;
|
||||||
w(event);
|
w(event);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!slot.waiters.empty)
|
if (!slot.waiters.empty) {
|
||||||
|
m_loop.m_waiterCount--;
|
||||||
slot.waiters.consumeOne()(event);
|
slot.waiters.consumeOne()(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final override void trigger(EventID event, bool notify_all)
|
final override void trigger(EventID event, bool notify_all)
|
||||||
shared @trusted {
|
shared @trusted {
|
||||||
|
@ -1254,7 +1257,7 @@ final class PosixEventDriverEvents(Loop : PosixEventLoop, Sockets : EventDriverS
|
||||||
final override void wait(EventID event, EventCallback on_event)
|
final override void wait(EventID event, EventCallback on_event)
|
||||||
{
|
{
|
||||||
m_loop.m_waiterCount++;
|
m_loop.m_waiterCount++;
|
||||||
return getSlot(event).waiters.put(on_event);
|
getSlot(event).waiters.put(on_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
final override void cancelWait(EventID event, EventCallback on_event)
|
final override void cancelWait(EventID event, EventCallback on_event)
|
||||||
|
|
Loading…
Reference in a new issue