Mutex

Mutex

ri

 ----------------------------------------------------------- Class: Mutex
      Mutex implements a simple semaphore that can be used to coordinate
      access to shared data from multiple concurrent threads.
 
      Example:
 
        require 'thread'
        semaphore = Mutex.new
      
        a = Thread.new {
          semaphore.synchronize {
            # access shared resource
          }
        }
      
        b = Thread.new {
          semaphore.synchronize {
            # access shared resource
          }
        }
 
 ------------------------------------------------------------------------
 
 
 Class methods:
 --------------
      new
 
 
 Instance methods:
 -----------------
      exclusive_unlock, lock, locked?, synchronize, try_lock, unlock

refe

 ==== Mutex ====
 Mutex(Mutal Exclusion = 相互排他ロック)は共有データを並行アクセスから保護する
 ためにあります。Mutex の典型的な使い方は(mを
 Mutexオブジェクトとします):
 
   m.lock
   begin
     # mによって保護されたクリティカルセクション
   ensure
     m.unlock
   end
 
 または、より簡単に
 
   m.synchronize {
     # mによって保護されたクリティカルセクション
   }
 ---- Singleton methods ----
 new
 ---- Instance methods ----
 exclusive_unlock lock locked? synchronize try_lock unlock
 ---- Singleton methods (inherited) ----
 ---- Instance methods (inherited) ----
 == === =~ __id__ __send__ _dump _load class clone display
 dup eql? equal? extend freeze frozen? hash id initialize
 initialize_copy inspect instance_eval instance_of?
 instance_variable_get instance_variable_set
 instance_variables is_a? kind_of? marshal_dump marshal_load
 method method_missing methods nil? object_id pretty_print
 pretty_print_cycle pretty_print_instance_variables
 private_methods protected_methods public_methods
 remove_instance_variable respond_to? send
 singleton_method_added singleton_method_removed
 singleton_method_undefined singleton_methods taint tainted?
 to_a to_ary to_hash to_int to_s to_str type untaint