Modify require logic to block when two threads require the same file at the
same time
-------------------------------------------------------------------------------------
Key: JRUBY-3343
URL: http://jira.codehaus.org/browse/JRUBY-3343
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.1.6
Reporter: Charles Oliver Nutter
Fix For: JRuby 1.2
Matz has spoken!
Matz:
I propose that two or more separated threads may not load same library
more than once. It can be accomplished by the behavior that Nobu
stated, or having a single lock around require. I can stand deadlock
for circular requires. Thread users must pay attention for deadlocks
anyway. Besides circular require is a bad habit.
Charlie:
Currently JRuby will not allow the same library to load twice, but it will not
detect that the library has not *finished* loading.
So if two threads require the same file, one of them will actually require it
and the other will see that the file has already been required and continue
immediately. It may fail later if the require has not yet finished.
If I understand you, a second thread requiring a file currently being required
should block and wait for that require to complete, yes?
Circular requires will definitely lead to deadlock, but if they're rare and
strongly discouraged, I'm ok with that.
Matz:
|If I understand you, a second thread requiring a file currently being
|required should block and wait for that require to complete, yes?
Yes.
|Circular requires will definitely lead to deadlock, but if they're rare
|and strongly discouraged, I'm ok with that.
Yes, please.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email