Class: Timeout::Request
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/timeout.rb |
Class Method Summary
Instance Attribute Summary
- #deadline readonly
- #done? ⇒ Boolean readonly
Instance Method Summary
Constructor Details
.new(thread, timeout, exception_class, message) ⇒ Request
Instance Attribute Details
#deadline (readonly)
[ GitHub ]# File 'lib/timeout.rb', line 58
attr_reader :deadline
#done? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/timeout.rb', line 70
def done? @mutex.synchronize do @done end end
Instance Method Details
#expired?(now) ⇒ Boolean
# File 'lib/timeout.rb', line 76
def expired?(now) now >= @deadline end
#finished
[ GitHub ]# File 'lib/timeout.rb', line 89
def finished @mutex.synchronize do @done = true end end
#interrupt
[ GitHub ]# File 'lib/timeout.rb', line 80
def interrupt @mutex.synchronize do unless @done @thread.raise @exception_class, @message @done = true end end end