Check return value of eventfd for errors.

This commit is contained in:
Sönke Ludwig 2017-03-27 16:31:00 +02:00
parent f4ca542b92
commit 1ff3d00020
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -35,7 +35,9 @@ final class PosixEventDriverEvents(Loop : PosixEventLoop, Sockets : EventDriverS
final override EventID create() final override EventID create()
{ {
version (linux) { version (linux) {
auto id = cast(EventID)eventfd(0, EFD_NONBLOCK); auto eid = eventfd(0, EFD_NONBLOCK);
if (eid == -1) return EventID.invalid;
auto id = cast(EventID)eid;
m_loop.initFD(id); m_loop.initFD(id);
m_loop.m_fds[id].specific = EventSlot(new ConsumableQueue!EventCallback); // FIXME: avoid dynamic memory allocation m_loop.m_fds[id].specific = EventSlot(new ConsumableQueue!EventCallback); // FIXME: avoid dynamic memory allocation
m_loop.registerFD(id, EventMask.read); m_loop.registerFD(id, EventMask.read);