# sync.rb

Path: | sync.rb
Last Update: | Thu Jun 07 00:19:33 AUS Eastern Standard Time 2001

      sync.rb - 2 phase lock with counter
          $Release Version: 1.0$
          $Revision: 1.4 $
          $Date: 2001/06/06 14:19:33 $
          by Keiju ISHITSUKA(keiju@ishitsuka.com)

—

     Sync_m, Synchronizer_m
     Usage:
      obj.extend(Sync_m)
      or
      class Foo
          include Sync_m
          :
      end

      Sync_m#sync_mode
      Sync_m#sync_locked?, locked?
      Sync_m#sync_shared?, shared?
      Sync_m#sync_exclusive?, sync_exclusive?
      Sync_m#sync_try_lock, try_lock
      Sync_m#sync_lock, lock
      Sync_m#sync_unlock, unlock

      Sync, Synchronicer:
          include Sync_m
      Usage:
      sync = Sync.new

      Sync#mode
      Sync#locked?
      Sync#shared?
      Sync#exclusive?
      Sync#try_lock(mode) -- mode = :EX, :SH, :UN
      Sync#lock(mode)     -- mode = :EX, :SH, :UN
      Sync#unlock
      Sync#synchronize(mode) {...}

### Constants

Synchronizer_m | = | Sync_m
Synchronizer | = | Sync

[Validate]