>> I'm curious about the "constant definition not being threadsafe" -- is
>> this a thread safe bug in MRI?
>>
> One of the problems here is that the class which is being defined is
> visible in other threads. So threads may see partially defined classes.
> This is very hard to fix. And it's indeed ruby's (not just MRI, I
> believe) problem.

Yes this is the issue exactly, and it's a design thing, not just some
implementation detail.  This is why rails 2.2 preloads your
application classes.

> In MRI it is possible to stop all other threads (by setting
> Thread.critical) and Rails could try to solve this problem by holding
> this flag around #load and #require. But this is not a proper solution,
> because Thread.critical is implementation-specific feature and sooner or
> later ruby will need to get rid of it. And it should be noted that even
> this solution may fail if fancy things is tried during load. For example
> if it tries to lock some mutex, which is locked by some other thread.

Thread.critical and friends aren't in 1.9, so it'd be a mistake for us
to build on top of them.  Also as you mentioned it's almost impossible
to write deterministic code when you have threads grabbing critical
status while other threads have locks.

> --
> Aliaksey Kandratsenka <[EMAIL PROTECTED]>
>
>
> >
>



-- 
Cheers

Koz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to