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

Add methods to Crystal::EventLoop #14977

Conversation

ysbaddaden
Copy link
Contributor

@ysbaddaden ysbaddaden commented Sep 5, 2024

Add #after_fork_before_exec to allow an evloop to do some cleanup before exec (UNIX only).
Add #remove(io) to allow an evloop to free resources when the IO is closed in a GC finalizer.

Extracted from #14959

@ysbaddaden
Copy link
Contributor Author

Oh my, trying to resolve the event loop in a finalizer led to a big segfault on linux because it tried to access it before something got initialized (e.g. the thread or main fiber). We need a safe way to access the current evloop which can return nil.

https://github.com/crystal-lang/crystal/actions/runs/10736339467/job/29775532447

@ysbaddaden ysbaddaden added this to the 1.14.0 milestone Sep 6, 2024
@straight-shoota straight-shoota merged commit bdddae7 into crystal-lang:master Sep 9, 2024
63 of 65 checks passed
@straight-shoota straight-shoota changed the title Add methods to Crystal::EventLoop Add methods to Crystal::EventLoop Sep 9, 2024
@ysbaddaden ysbaddaden deleted the feature/add-methods-to-event-loop branch September 13, 2024 13:26
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.

2 participants