From c2c5c7061059f687d6a2087c28a179e10d3ccec8 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Tue, 4 Jul 2017 09:02:49 +0200 Subject: [PATCH] Correctly handle eventfd_write error and also wrap as syscall --- Sources/NIO/Selector.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/NIO/Selector.swift b/Sources/NIO/Selector.swift index f8db9bf0..def96a30 100644 --- a/Sources/NIO/Selector.swift +++ b/Sources/NIO/Selector.swift @@ -382,8 +382,9 @@ final class Selector { throw IOError(errno: EBADF, reason: "can't wakeup selector as it's not open anymore.") } #if os(Linux) - // TODO: Should we throw an error if it returns != 0 ? - let _ = CEventfd.eventfd_write(eventfd, 1) + let _ = try wrapSyscall({ $0 == 0 }, function: "eventfd_write") { + CEventfd.eventfd_write(eventfd, 1) + } #else var event = kevent() event.ident = 0