Class: Secure::GuardThread
- Inherits:
-
Thread
- Object
- Thread
- Secure::GuardThread
- Defined in:
- lib/secure/guard_thread.rb
Class Method Summary collapse
Class Method Details
.kill_thread_on_timeout(secs, thread) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/secure/guard_thread.rb', line 4 def kill_thread_on_timeout(secs, thread) Thread.start(secs, thread) do |s, t| t.join(s) t.raise(TimeoutError, "This thread has taken more than #{s} seconds") end end |