From 208c9ab3457afdc96b0cedd26f97c8ad33f34150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Sat, 18 Jun 2016 08:11:34 +0200 Subject: [PATCH] Consume eventfd data to avoid the select based driver getting stuck. --- source/eventcore/drivers/posix.d | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/eventcore/drivers/posix.d b/source/eventcore/drivers/posix.d index 5335f86..e53a6a6 100644 --- a/source/eventcore/drivers/posix.d +++ b/source/eventcore/drivers/posix.d @@ -15,7 +15,7 @@ import std.socket : Address, AddressFamily, UnknownAddress; version (Posix) { import core.sys.posix.netinet.in_; import core.sys.posix.netinet.tcp; - import core.sys.posix.unistd : close, write; + import core.sys.posix.unistd : close, read, write; import core.stdc.errno : errno, EAGAIN, EINPROGRESS; import core.sys.posix.fcntl; } @@ -535,6 +535,8 @@ abstract class PosixEventDriver : EventDriver { private void onEvent(FD event) @trusted { + ulong cnt; + () @trusted { read(event, &cnt, cnt.sizeof); } (); import core.atomic : cas; auto all = cas(&m_fds[event].triggerAll, true, false); triggerEvent(cast(EventID)event, all);