Support for the Ruby 2.4 series has ended. See here for reference.
When 'mutex_m' is required, any object that extends or includes Mutex_m
will be treated like a Mutex.
Start by requiring the standard library Mutex_m
:
require "mutex_m.rb"
From here you can extend an object with Mutex instance methods:
obj = Object.new obj.extend Mutex_m
Or mixin Mutex_m
into your module to your class inherit Mutex instance methods.
class Foo include Mutex_m # ... end obj = Foo.new # this obj can be handled like Mutex
See Mutex#lock
# File mutex_m.rb, line 88 def mu_lock @_mutex.lock end
See Mutex#locked?
# File mutex_m.rb, line 78 def mu_locked? @_mutex.locked? end
See Mutex#synchronize
# File mutex_m.rb, line 73 def mu_synchronize(&block) @_mutex.synchronize(&block) end
See Mutex#try_lock
# File mutex_m.rb, line 83 def mu_try_lock @_mutex.try_lock end