diff --git a/Sources/Selector.swift b/Sources/Selector.swift index 38c8a9e4a..f9d6ce10f 100644 --- a/Sources/Selector.swift +++ b/Sources/Selector.swift @@ -38,14 +38,14 @@ public class Selector { guard fd >= 0 else { throw IOError(errno: errno, reason: "Creation of epoll failed") } - events = UnsafeMutablePointer.allocate(capacity: 2048) // max 2048 events per epoll_wait #else fd = Darwin.kqueue() guard fd >= 0 else { throw IOError(errno: errno, reason: "Creation of kqueue failed") } - events = UnsafeMutablePointer.allocate(capacity: 2048) // max 2048 events per kevent(...) call #endif + events = UnsafeMutablePointer.allocate(capacity: 2048) // max 2048 events per epoll/kqueue call + events.initialize(to: kevent()) } deinit {