mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
initialise memory correctly
This commit is contained in:
1 parent
2a28806f16
commit
b61479939b
1 file changed
+2
-2
@@ -38,14 +38,14 @@ public class Selector {
|
||||
guard fd >= 0 else {
|
||||
throw IOError(errno: errno, reason: "Creation of epoll failed")
|
||||
}
|
||||
events = UnsafeMutablePointer<epoll_event>.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<kevent>.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 {
|
||||
|
||||
Reference in new issue
Block a user