Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the EventLoop implementation to be detected at runtime #12656

Merged

Conversation

lbguilherme
Copy link
Contributor

@lbguilherme lbguilherme commented Oct 24, 2022

This is a part of #10740 / #10768.

Currently each target must implement the event loop interface, which is a module with static methods. This PR changes the module to be an abstract class instead. The goal is to support systems where multiple event loops are available and can be selected at runtime (Linux with io_uring, for example). No additional event loop implementation is introduced here.

The event loop instance is held by an instance variable at Crystal::Scheduler (one per thread) and can be accessed with Crystal::Scheduler.event_loop. This is not a public API!

#10768 will later be refactored on top of this PR.

src/crystal/system/event_loop.cr Outdated Show resolved Hide resolved
src/crystal/system/unix/event_libevent.cr Outdated Show resolved Hide resolved
src/crystal/system/unix/event_loop_libevent.cr Outdated Show resolved Hide resolved
Copy link
Member

@beta-ziliani beta-ziliani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@beta-ziliani beta-ziliani added this to the 1.7.0 milestone Oct 28, 2022
@straight-shoota straight-shoota merged commit 56dc735 into crystal-lang:master Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants