Crystal::EventLoop::FileDescriptor#open now sets the non/blocking flag#15754
Merged
straight-shoota merged 3 commits intocrystal-lang:masterfrom May 19, 2025
Conversation
a20deaf to
a7d89af
Compare
ysbaddaden
commented
May 12, 2025
| @@ -7,7 +7,7 @@ abstract class Crystal::EventLoop | |||
| # `nil`. | |||
| # | |||
| # Returns the system file descriptor or handle, or a system error. | |||
Collaborator
Author
There was a problem hiding this comment.
Suggested change
| # Returns the system file descriptor or handle, or a system error. | |
| # Returns the system file descriptor or handle and the actual | |
| # blocking state, or a system error. |
Collaborator
Author
There was a problem hiding this comment.
We must return the blocking value because:
- it may not be the same value (event-loop can decide otherwise);
- win32 needs to save the actual value as
@system_blockingin theFileobject;
ysbaddaden
commented
May 12, 2025
ysbaddaden
commented
May 12, 2025
ysbaddaden
commented
May 12, 2025
| end | ||
|
|
||
| # :nodoc: | ||
| def self.from_fd(path : String, fd : Int, *, blocking = false, encoding = nil, invalid = nil) |
Collaborator
Author
There was a problem hiding this comment.
That constructor was already unused.
straight-shoota
approved these changes
May 17, 2025
This was referenced May 23, 2025
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the responsibility to set
FILE_FLAG_OVERLAPPEDorO_NONBLOCKto each event loop, so they can eventually own the blocking flag.There is no change in behavior, yet: the event loops still set the flag depending on the
blockingargument.Refactors the
IO::FileDescriptorandFileinternal constructors so we can instantiate the object without changing the blocking state (already set).Extracted from #15685.
Depends on #15750 and #15753.