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 55
attr_reader :deadline
#done? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/timeout.rb', line 67
def done? @mutex.synchronize do @done end end
Instance Method Details
#expired?(now) ⇒ Boolean
# File 'lib/timeout.rb', line 73
def expired?(now) now >= @deadline end
#finished
[ GitHub ]# File 'lib/timeout.rb', line 86
def finished @mutex.synchronize do @done = true end end
#interrupt
[ GitHub ]# File 'lib/timeout.rb', line 77
def interrupt @mutex.synchronize do unless @done @thread.raise @exception_class, @message @done = true end end end