def wait(timeout=nil)
      raise 'This thread is already a registered sleeper' if @threads.include?(Thread.current)
      Thread.exclusive{ @threads << Thread.current }
      if(timeout)
        timeout = timeout.to_f
        Thread.exclusive{ @timers[Thread.current] = timeout }
        @timer.raise Wakeup.new
      end
      Thread.stop
      Thread.exclusive{ @threads.delete(Thread.current) }
      if(timeout && @timers.has_key?(Thread.current))
        Thread.exclusive{ @timers.delete(Thread.current) }
        @timer.raise Wakeup.new
      end
      true
    end
def wait(timeout=nil)
      raise 'This thread is already a registered sleeper' if @threads.include?(Thread.current)
      Thread.exclusive{ @threads << Thread.current }
      if(timeout)
        timeout = timeout.to_f
        Thread.exclusive{ @timers[Thread.current] = timeout }
        @timer.raise Wakeup.new
      end
      Thread.stop
      Thread.exclusive{ @threads.delete(Thread.current) }
      if(timeout && @timers.has_key?(Thread.current))
        Thread.exclusive{ @timers.delete(Thread.current) }
        @timer.raise Wakeup.new
      end
      true
    end
Create a new Monitor
 timeout:: Wait for given amount of time
 Park a thread here