Add Crystal::EventLoop#drain(&)#16522
Closed
ysbaddaden wants to merge 1 commit intocrystal-lang:masterfrom
Closed
Conversation
straight-shoota
approved these changes
Dec 19, 2025
| # Must yield every runnable fiber. | ||
| # | ||
| # Optional. | ||
| def drain(& : Fiber ->) : Nil |
Member
There was a problem hiding this comment.
thought: Since the implementation is optional and we really only need it for a single implementation, maybe we shouldn't add it to the generic interface? It seems silly to have this method on all event loop interfaces but it doesn't do anything.
As an alternative, we could implement it only for EventLoop::IOUring and check with @event_loop.responds_to?(:drain).
Collaborator
Author
|
Yes, probably a better idea for starters. |
Collaborator
Author
|
Closing. Since it involved 2 distinct parts (EC vs EV) a formal API was interesting, but I'm not so sure about the name and expected behavior. The io_uring branch will simply patch support. |
ysbaddaden
added a commit
to ysbaddaden/crystal
that referenced
this pull request
Jan 12, 2026
ysbaddaden
added a commit
to ysbaddaden/crystal
that referenced
this pull request
Jan 23, 2026
ysbaddaden
added a commit
to ysbaddaden/crystal
that referenced
this pull request
Jan 29, 2026
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.
This is needed by the io_uring event loop that must drain a scheduler's local ring before it shutdown (e.g. when a context is resized down).
Extracted from #16264