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 Crystal.once_init replacing __crystal_once_init #15371

Conversation

ysbaddaden
Copy link
Contributor

@ysbaddaden ysbaddaden commented Jan 24, 2025

Adds Crystal.once_init that allows to remove the Crystal.once_mutex= setter.

It also removes the need for the __crystal_once_init fun that won't be defined anymore —it's only kept for the legacy implementation. This is one less compiler dependency on runtime.

Follow up to #15369

Prefer a def explictly called by `Crystal.init_runtime` over the
implicit `__crystal_once_init` fun injected by the compiler.

The fun is no longer defined for new compiler builds, however it's still
defined to support older compiler releases.
@ysbaddaden ysbaddaden force-pushed the refactor/explicit-crystal-once-init branch from ab1c6e3 to ffd6b86 Compare January 27, 2025 14:02
@ysbaddaden ysbaddaden marked this pull request as ready for review January 27, 2025 14:02
@straight-shoota straight-shoota added this to the 1.16.0 milestone Jan 27, 2025
ysbaddaden added a commit to ysbaddaden/crystal that referenced this pull request Jan 28, 2025
@straight-shoota straight-shoota merged commit 80e051d into crystal-lang:master Jan 28, 2025
70 checks passed
@straight-shoota straight-shoota changed the title Explicit Crystal.once_init method Add Crystal.once_init replacing __crystal_once_init Jan 28, 2025
@ysbaddaden ysbaddaden deleted the refactor/explicit-crystal-once-init branch January 30, 2025 09:02
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