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