-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
use Posix.read instead of Glibc.read for timerfd #1432
Conversation
Sources/NIO/Selector.swift
Outdated
@@ -549,7 +549,7 @@ internal class Selector<R: Registration> { | |||
// Consume event | |||
var val: UInt64 = 0 | |||
// We are not interested in the result | |||
_ = Glibc.read(self.timerFD, &val, MemoryLayout.size(ofValue: val)) | |||
_ = try! Posix.read(self.timerFD, &val, MemoryLayout.size(ofValue: val)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you're missing some labels here:
swift-nio/Sources/NIO/System.swift
Line 396 in 546a84c
public static func read(descriptor: CInt, pointer: UnsafeMutableRawPointer, size: size_t) throws -> IOResult<ssize_t> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking. I am figuring out the values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
@swift-nio-bot test this please |
I didn't understand the CI error. Please help me to understand it. |
ignore it, our CI is underpowered is what that means :( |
@swift-nio-bot test this please |
Thanks! :) |
Motivation:
To read the bytes from
timerfd
, we use Glibc.read directly but we should usetry! Posix.read
Modifications:
Using
Posix
instead ofGlibc
for read operation withtry!
to check for any error.Result:
Fixes #1341