From: Brent Roman Date: 2008-12-04T14:03:12+09:00 Subject: [ruby-core:20293] Re: autoload and concurrency Charlie, Yes. I agree. There's really no significant difference between a single code loader thread and a single global (recursive) Mutex. The mutex, after all, contains the queue of waiting threads. It also occurs to me that if code loaded via "require" has absolutely no restrictions on what it can do (spawn threads, block indefinitely, side effect), then this problem is insoluble. Ruby isn't Erlang. It only achieves some degree of thread safety when used very carefully. I think the best we can hope is to create a mechanism that allows require and auto-load to work reliably in "well behaved" multi-threaded apps and to explain the restrictions placed on code being loaded via require for thread safety. - brent Charles Oliver Nutter-2 wrote: > > Brent Roman wrote: >> There are some details I'm (knowingly) omitting. >> Does anyone see any truck sized holes in this general idea? > > I don't think this is really any different than having a single mutex > for all requires. The requiring thread would acquire it for the duration > of the require. Any additional requires it runs into it would still have > the lock for. Any other threads doing requires would block until that > thread had come all the way back out. > ... > -- View this message in context: http://www.nabble.com/-ruby-core%3A20235--autoload-and-concurrency-tp20806574p20827430.html Sent from the ruby-core mailing list archive at Nabble.com.