Class: UniqueThread::HeldLock
- Defined in:
- lib/unique_thread/locksmith.rb
Instance Attribute Summary
Attributes inherited from Lock
#locked_until, #locksmith, #stopwatch
Instance Method Summary collapse
Methods inherited from Lock
Constructor Details
This class inherits a constructor from UniqueThread::Lock
Instance Method Details
#acquired? ⇒ Boolean
68 69 70 |
# File 'lib/unique_thread/locksmith.rb', line 68 def acquired? true end |
#while_held ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/unique_thread/locksmith.rb', line 72 def while_held worker = UniqueThread.safe_thread do yield UniqueThread.logger.error('The blocked passed is not an infinite loop.') end renew_indefinitely UniqueThread.logger.info('Lock lost! Killing the unique thread.') worker.terminate end |