Class: Litesupport::Mutex
- Inherits:
-
Object
- Object
- Litesupport::Mutex
- Defined in:
- lib/litestack/litesupport.rb
Instance Method Summary collapse
-
#initialize ⇒ Mutex
constructor
A new instance of Mutex.
- #synchronize(&block) ⇒ Object
Constructor Details
#initialize ⇒ Mutex
Returns a new instance of Mutex.
69 70 71 |
# File 'lib/litestack/litesupport.rb', line 69 def initialize @mutex = Thread::Mutex.new end |
Instance Method Details
#synchronize(&block) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/litestack/litesupport.rb', line 73 def synchronize(&block) if Litescheduler.backend == :threaded || Litescheduler.backend == :iodine @mutex.synchronize { block.call } else block.call end end |