def enter(timeout = nil, wait = 0.01)
      time_at_timeout = Time.now + timeout if timeout
      while !timeout || Time.now < time_at_timeout
        return true if try_enter
        sleep(wait)
      end
      false
    end
def enter(timeout = nil, wait = 0.01)
      time_at_timeout = Time.now + timeout if timeout
      while !timeout || Time.now < time_at_timeout
        return true if try_enter
        sleep(wait)
      end
      false
    end
Enter critical section (blocking)

 @param [Number] timeout Maximum time to wait
 @param [Number] wait Sleep time between tries to acquire lock
 @return [Boolean] true if the lock was aquired