Class: Higgs::GiantLockManager
- Inherits:
-
LockManager
- Object
- LockManager
- Higgs::GiantLockManager
- Defined in:
- lib/higgs/lock.rb
Constant Summary collapse
- CVS_ID =
for ident(1)
'$Id: lock.rb 841 2008-12-24 09:23:20Z toki $'
Instance Method Summary collapse
-
#initialize(*args) ⇒ GiantLockManager
constructor
A new instance of GiantLockManager.
- #transaction(read_only = false) ⇒ Object
Methods inherited from LockManager
Constructor Details
#initialize(*args) ⇒ GiantLockManager
Returns a new instance of GiantLockManager.
107 108 109 110 |
# File 'lib/higgs/lock.rb', line 107 def initialize(*args) super @write_lock = Mutex.new end |
Instance Method Details
#transaction(read_only = false) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/higgs/lock.rb', line 112 def transaction(read_only=false) r = nil @tx_lock.read_lock.synchronize{ if (read_only) then r = yield(NoWorkLockHandler.instance) else @write_lock.synchronize{ r = yield(NoWorkLockHandler.instance) } end } r end |