In the case of (2), would it be possible to force a thread attempting to
use a feature in a library that was in the process of loading to block
until the library had finished? That seems like it would solve the only
potential problem with (2).
I agree that (3) has all kinds of potential deadlock issues, and that
(1) won't be sufficent as more and more multithreaded apps come up.
Charles Oliver Nutter wrote:
I've got a question about require thread safety: should we try to
enforce it?
For example, if two scripts try to require the same file at once,
should we:
1. do what we do now, and potentially they both execute the file
2. synchronize against the list of loaded features, such that they may
both search for the library but only one will load it; however, this
won't guarantee the library has been *completely* loaded
3. synchronize against both the list of loaded features and any
features still in the process of loading; this guarantees that require
will never re-load a script and will not return until any other
requires on other threads have completed; but it may lead to deadlocks
if two threads attempt to load the same two libraries in different
orders.
At the moment I'm leaning toward improving the situation at least to
(2) above, but not doing (3) because MRI makes no such guarantees and
the deadlock potential is too high. Am I right about that? Other
thoughts?
- Charlie
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email