MenTaLguY wrote:
> Well, to be clear you should always be requiring 'thread' too.  

That got me thinking, and I eventually concluded the recommended 
practice should be:

    Do this:

        require 'thread'
        begin
          require 'fastthread'
        rescue LoadError
        end

    BEFORE you require 'thread' or anything that might indirectly 
require
    'thread' (e.g., drb).


If one just did a require 'fastthread', then a subsequent require 
'thread' would undo it.

If messed up and did the "require 'thread' ... require 'fastthread'..." 
AFTER requiring a file that did its own require 'thread', then there 
would be a chance something in the interim used the un-augmented 
'thread'.

The safest thing, it seems to me, is to do the "require 
'thread'....require 'fastthread'..." business at the very begining of 
one's application, if there's a chance 'thread' is used anywhere.

All bets are off if "load" is used to directly or indirectly load 
thread.rb.  Surely nobody does that :)

Of course, I could be missing something here.  Thoughts?

-- 
Posted via http://www.ruby-forum.com/.