    # File lib/phusion_passenger/utils.rb, line 882
            def timed_wait(mutex, secs)
                    ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
                    if secs > 100000000
                            # NOTE: If one calls timeout() on FreeBSD 5 with an
                            # argument of more than 100000000, then MRI will become
                            # stuck in an infite loop, blocking all threads. It seems
                            # that MRI uses select() to implement sleeping.
                            # I think that a value of more than 100000000 overflows
                            # select()'s data structures, causing it to behave incorrectly.
                            # So we just make sure we can't sleep more than 100000000
                            # seconds.
                            secs = 100000000
                    end
                    if ruby_engine == "jruby"
                            if secs > 0
                                    return wait(mutex, secs)
                            else
                                    return wait(mutex)
                            end
                    elsif RUBY_VERSION >= '1.9.2'
                            if secs > 0
                                    t1 = Time.now
                                    wait(mutex, secs)
                                    t2 = Time.now
                                    return t2.to_f - t1.to_f < secs
                            else
                                    wait(mutex)
                                    return true
                            end
                    else
                            if secs > 0
                                    Timeout.timeout(secs) do
                                            wait(mutex)
                                    end
                            else
                                    wait(mutex)
                            end
                            return true
                    end
            rescue Timeout::Error
                    return false
            end