# File lib/phusion_passenger/utils.rb, line 918
        def timed_wait!(mutex, secs)
                ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
                if secs > 100000000
                        # See the corresponding note for timed_wait().
                        secs = 100000000
                end
                if ruby_engine == "jruby"
                        if secs > 0
                                if !wait(mutex, secs)
                                        raise Timeout::Error, "Timeout"
                                end
                        else
                                wait(mutex)
                        end
                elsif RUBY_VERSION >= '1.9.2'
                        if secs > 0
                                t1 = Time.now
                                wait(mutex, secs)
                                t2 = Time.now
                                if t2.to_f - t1.to_f >= secs
                                        raise Timeout::Error, "Timeout"
                                end
                        else
                                wait(mutex)
                        end
                else
                        if secs > 0
                                Timeout.timeout(secs) do
                                        wait(mutex)
                                end
                        else
                                wait(mutex)
                        end
                end
                return nil
        end