summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2023-01-11 14:56:47 +0100
committergit <svn-admin@ruby-lang.org>2023-01-12 05:41:59 +0000
commita8537eae2abf307ec22446d617900796741520a8 (patch)
tree1f739bdc723f14d320c5282bf4de64507e42822d /lib
parent0e21c9f57e4bcca4daab93d0645ee642e1f97675 (diff)
[ruby/mutex_m] Avoid anonymous eval
It makes it hard to locate code when profiling etc. https://github.com/ruby/mutex_m/commit/8760ab19ec
Diffstat (limited to 'lib')
-rw-r--r--lib/mutex_m.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/mutex_m.rb b/lib/mutex_m.rb
index 17ec9924e4..4c888d6a17 100644
--- a/lib/mutex_m.rb
+++ b/lib/mutex_m.rb
@@ -44,13 +44,11 @@ module Mutex_m
Ractor.make_shareable(VERSION) if defined?(Ractor)
def Mutex_m.define_aliases(cl) # :nodoc:
- cl.module_eval %q{
- alias locked? mu_locked?
- alias lock mu_lock
- alias unlock mu_unlock
- alias try_lock mu_try_lock
- alias synchronize mu_synchronize
- }
+ cl.alias_method(:locked?, :mu_locked?)
+ cl.alias_method(:lock, :mu_lock)
+ cl.alias_method(:unlock, :mu_unlock)
+ cl.alias_method(:try_lock, :mu_try_lock)
+ cl.alias_method(:synchronize, :mu_synchronize)
end
def Mutex_m.append_features(cl) # :nodoc: