Terrible_timeout 0.1.0 - an alternative to timeout

This module still sucks, don’t use it without knowing its caveats. Read
the RDoc, source code and code comments to understand it. Do not use
this module without reading, reviewing, and understanding it completely.

This is extracted from the Rainbows::ThreadTimeout middleware
distributed with {Rainbows!}[http://rainbows.rubyforge.org/]
This is INCOMPATIBLE with Rainbows::ThreadTimeout

It behaves like Timeout.timeout in the Ruby standard library, but:

  • does not support nesting timeouts

  • only spawns one Thread per-process instead of one thread per-timeout

  • is explicitly incompatible with anything that else that uses
    Thread#raise

    TerribleTimeout.run(666) do
    puts “HELLO WORLD”
    end

You should read and understand all the code and all the caveats of this
module before using it.

== Caveats

Badly-written C extensions may not be timed out. Audit and fix
(or remove) those extensions before relying on this module.

Do NOT assume “ensure” clauses will fire properly

Do NOT mix this with an existing Timeout.timeout block

Do NOT use Rainbows::ThreadTimeout with this

Do NOT nest invocations of this.

This will behave badly if system time is changed since Ruby
does not expose a monotonic clock for users, so don’t change
the system time while this is running. All servers should be
running ntpd anyways.

You probably shouldn’t use this (nor Timeout, nor
Rainbows::ThreadTimeout).

On Dec 7, 2011, at 16:18 , Eric W. wrote:

This module still sucks, don’t use it without knowing its caveats. Read
the RDoc, source code and code comments to understand it. Do not use
this module without reading, reviewing, and understanding it completely.

That’s true of everything. Maybe we should have this clause added to our
licenses. :stuck_out_tongue:

Ryan D. [email protected] wrote:

On Dec 7, 2011, at 16:18 , Eric W. wrote:

This module still sucks, don’t use it without knowing its caveats.
Read the RDoc, source code and code comments to understand it. Do
not use this module without reading, reviewing, and understanding it
completely.

That’s true of everything. Maybe we should have this clause added to
our licenses. :stuck_out_tongue:

Heh, I reread my own code before using it, too.

I just pushed out 0.2.0 which fixes a race condition I noticed
(also drops Ruby 1.8 compatibility, but 1.8 is dead to me)

On Wed, Dec 7, 2011 at 19:18, Eric W. [email protected] wrote:

This module still sucks, don’t use it without knowing its caveats. Read
the RDoc, source code and code comments to understand it. Do not use
this module without reading, reviewing, and understanding it completely.

Side effects may include dry mouth, DRY code, a tingling sense of
accomplishment, spontaneous combustion, alien abduction, and the
eventual heat death of the universe? :wink:

-Dave