Paul Brannan wrote: > On Wed, Nov 12, 2008 at 04:06:00AM +0900, Charles Oliver Nutter wrote: >> I've given this a lot of thought, and I'm just about positive the best >> you can do is return immediately if another thread has *started* >> requiring a given file. There's no safe way to ensure it has >> *completed*. Ultimately I think the more important guarantee is that >> require cause a file to start loading *exactly once*. > > Wouldn't this also break code? > > require 'foo' # returns immediately since foo.rb is being loaded in > # another thread > f = Foo.new # Fails, since class Foo is defined in foo.rb It would break code that's doing what it shouldn't, i.e. requiring the same lib across several threads. So don't do that :) - Charlie