class Thread

Public Instance Methods

wait_for_key( k, tmout ) click to toggle source
# 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