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

Rework initialization of constants & class variables #15333

Merged
merged 12 commits into from
Jan 20, 2025
8 changes: 7 additions & 1 deletion src/crystal/once.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@

{% if flag?(:preview_mt) || flag?(:win32) %}
@@once_mutex = uninitialized Mutex
ysbaddaden marked this conversation as resolved.
Show resolved Hide resolved
class_property once_mutex : Mutex

def self.once_mutex : Mutex
@@once_mutex
end

def self.once_mutex=(@@once_mutex : Mutex)
end
ysbaddaden marked this conversation as resolved.
Show resolved Hide resolved
{% end %}

# Using @[NoInline] so LLVM optimizes for the hot path (var already
Expand Down