Skip to content

Commit

Permalink
No need for Crystal.once_mutex getter
Browse files Browse the repository at this point in the history
  • Loading branch information
ysbaddaden committed Jan 16, 2025
1 parent e42a575 commit 4f5092e
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/crystal/once.cr
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
{% if flag?(:preview_mt) || flag?(:win32) %}
@@once_mutex = uninitialized Mutex

# :nodoc:
def self.once_mutex : Mutex
@@once_mutex
end

# :nodoc:
def self.once_mutex=(@@once_mutex : Mutex)
end
Expand All @@ -45,7 +40,7 @@
@[NoInline]
def self.once(flag : OnceState*, initializer : Void*) : Nil
{% if flag?(:preview_mt) || flag?(:win32) %}
Crystal.once_mutex.synchronize { once_exec(flag, initializer) }
@@once_mutex.synchronize { once_exec(flag, initializer) }
{% else %}
once_exec(flag, initializer)
{% end %}
Expand Down

0 comments on commit 4f5092e

Please sign in to comment.