Skip to content

Register execution context schedulers with the event loop#16519

Merged
straight-shoota merged 2 commits intocrystal-lang:masterfrom
ysbaddaden:feature/register-schedulers-to-event-loop
Dec 21, 2025
Merged

Register execution context schedulers with the event loop#16519
straight-shoota merged 2 commits intocrystal-lang:masterfrom
ysbaddaden:feature/register-schedulers-to-event-loop

Conversation

@ysbaddaden
Copy link
Collaborator

Some event loops need to be aware of the execution context schedulers, to allocate and cleanup resources as schedulers are started and stopped.

For example the io_uring evloop will need to keep a ring per thread, yet can reuse the main ring for the first scheduler (index 0), and also needs to keep a list of all the active rings.

  • Add Crystal::EventLoop#initialize(parallelism).
  • Add Crystal::EventLoop#register(scheduler, index).
  • Add Crystal::EventLoop#unregister(scheduler).

Extracted from #16264

Some event loops need to be aware of the execution context schedulers,
to allocate and cleanup resources as schedulers are started and
stopped.

For example the io_uring evloop will need to keep a ring per thread, yet
can reuse the main ring for the first scheduler (index 0), and also
needs to keep a list of all the active rings.

- Add `Crystal::EventLoop#initialize(parallelism)`.
- Add `Crystal::EventLoop#register(scheduler, index)`.
- Add `Crystal::EventLoop#unregister(scheduler)`.
@straight-shoota straight-shoota added this to the 1.19.0 milestone Dec 19, 2025
@ysbaddaden ysbaddaden moved this from Review to Approved in Multi-threading Dec 19, 2025
@straight-shoota straight-shoota merged commit ff1677d into crystal-lang:master Dec 21, 2025
41 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in Multi-threading Dec 21, 2025
@ysbaddaden ysbaddaden deleted the feature/register-schedulers-to-event-loop branch December 22, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants