Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:19855] Re: use of require thread safety" > on Wed, 12 Nov 2008 07:10:46 +0900, Thomas Enebo <Thomas.Enebo / Sun.COM> writes: > > |> |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 :) > |> > |> Isn't that unavoidable when combined with autoload? > > |Autoload, in general, is a bad idea in a multiple thread environment. > > I agree. But sometimes it's up to library author's choice, not ours. I think in that case helping the author realize their mistake by raising an error is the best option. Given: * require must only initiate loading once * we can't guarantee loading has completed without risking deadlocks * callers of require expect loading to be completed by the time it returns Then: * it is impossible to provide all basic require guarantees to multiple threads requiring the same file at the same time And therefore: * we should raise an error - Charlie