Class: Thread

Inherits:
Object show all
Defined in:
lib/thread.rb

Instance Method Summary collapse

Instance Method Details

#wait_for_key(k, tmout) ⇒ Object



2
3
4
5
6
# File 'lib/thread.rb', line 2

def wait_for_key( k, tmout )
  start_time = Time.now
  sleep 0.01 until Thread.current.thread_variable?( k ) || Time.now - start_time >= tmout
  return Time.now - start_time < tmout
end