Module: Mutex_m
| Relationships & Source Files | |
| Defined in: | lib/mutex_m.rb | 
Overview
mutex_m.rb
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_mOr 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 MutexInstance Attribute Summary
- 
    
      #mu_locked?  ⇒ Boolean 
    
    readonly
    See Mutex#locked?
Instance Method Summary
- 
    
      #mu_lock  
    
    See Mutex#lock
- 
    
      #mu_synchronize(&block)  
    
    See Mutex#synchronize
- 
    
      #mu_try_lock  
    
    See Mutex#try_lock
- 
    
      #mu_unlock  
    
    See Mutex#unlock
- 
    
      #sleep(timeout = nil)  
    
    See Mutex#sleep
Instance Attribute Details
    #mu_locked?  ⇒ Boolean  (readonly)
  
See Mutex#locked?
# File 'lib/mutex_m.rb', line 78
def mu_locked? @_mutex.locked? end
Instance Method Details
#mu_lock
See Mutex#lock
# File 'lib/mutex_m.rb', line 88
def mu_lock @_mutex.lock end
#mu_synchronize(&block)
See Mutex#synchronize
# File 'lib/mutex_m.rb', line 73
def mu_synchronize(&block) @_mutex.synchronize(&block) end
#mu_try_lock
See Mutex#try_lock
# File 'lib/mutex_m.rb', line 83
def mu_try_lock @_mutex.try_lock end
#mu_unlock
See Mutex#unlock
# File 'lib/mutex_m.rb', line 93
def mu_unlock @_mutex.unlock end
#sleep(timeout = nil)
See Mutex#sleep
# File 'lib/mutex_m.rb', line 98
def sleep(timeout = nil) @_mutex.sleep(timeout) end