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

Thread owns its current fiber (instead of Crystal::Scheduler) #14554

Conversation

ysbaddaden
Copy link
Contributor

Moves the reference to the running Fiber from Crystal::Scheduler to Thread. This way the thread itself knows which fiber is currently running, independently of any scheduling.

This allows the GC collection callback as well as Fiber.current to access Thread#current_fiber directly, without having to know anything about the schedulers.

This is part 1 of abstracting Crystal::Scheduler away.

src/gc/boehm.cr Outdated Show resolved Hide resolved
@straight-shoota straight-shoota added this to the 1.13.0 milestone May 2, 2024
@straight-shoota straight-shoota changed the title Thread owns its current fiber (instead of Crystal::Scheduler) Thread owns its current fiber (instead of Crystal::Scheduler) May 3, 2024
@straight-shoota straight-shoota merged commit cf04c2e into crystal-lang:master May 5, 2024
60 checks passed
@ysbaddaden ysbaddaden deleted the refactor/put-current-fiber-on-thread branch May 5, 2024 19:18
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