|
58 | 58 | import org.jruby.ext.jruby.JRubyUtilLibrary; |
59 | 59 | import org.jruby.ext.thread.ConditionVariable; |
60 | 60 | import org.jruby.ext.thread.Mutex; |
| 61 | +import org.jruby.ext.thread.Queue; |
61 | 62 | import org.jruby.ext.thread.SizedQueue; |
62 | 63 | import org.jruby.ir.IRScope; |
63 | 64 | import org.jruby.ir.IRScriptBody; |
@@ -478,10 +479,13 @@ private Ruby(RubyInstanceConfig config) { |
478 | 479 |
|
479 | 480 | // Initialize exceptions |
480 | 481 | initExceptions(); |
481 | | - Mutex.setup(this); |
482 | | - ConditionVariable.setup(this); |
483 | | - org.jruby.ext.thread.Queue.setup(this); |
484 | | - SizedQueue.setup(this); |
| 482 | + |
| 483 | + // Thread library utilities |
| 484 | + mutexClass = Mutex.setup(threadClass, objectClass); |
| 485 | + conditionVariableClass = ConditionVariable.setup(threadClass, objectClass); |
| 486 | + queueClass = Queue.setup(threadClass, objectClass); |
| 487 | + closedQueueError = Queue.setupError(queueClass, stopIteration, objectClass); |
| 488 | + sizedQueueClass = SizedQueue.setup(threadClass, queueClass, objectClass); |
485 | 489 |
|
486 | 490 | fiberClass = new ThreadFiberLibrary().createFiberClass(this); |
487 | 491 |
|
@@ -562,10 +566,10 @@ private void initBootLibraries() { |
562 | 566 | } |
563 | 567 |
|
564 | 568 | // Provide some legacy libraries |
565 | | - loadService.provide("enumerator", "enumerator.rb"); |
566 | | - loadService.provide("rational", "rational.rb"); |
567 | | - loadService.provide("complex", "complex.rb"); |
568 | | - loadService.provide("thread", "thread.rb"); |
| 569 | + loadService.provide("enumerator.rb"); |
| 570 | + loadService.provide("rational.rb"); |
| 571 | + loadService.provide("complex.rb"); |
| 572 | + loadService.provide("thread.rb"); |
569 | 573 |
|
570 | 574 | // Load preludes |
571 | 575 | initRubyPreludes(); |
@@ -1774,8 +1778,8 @@ private void initJavaSupport() { |
1774 | 1778 | new Java().load(this, false); |
1775 | 1779 | new JRubyUtilLibrary().load(this, false); |
1776 | 1780 |
|
1777 | | - loadService.provide("java", "java.rb"); |
1778 | | - loadService.provide("jruby/util", "jruby/util.rb"); |
| 1781 | + loadService.provide("java.rb"); |
| 1782 | + loadService.provide("jruby/util.rb"); |
1779 | 1783 | } |
1780 | 1784 | } |
1781 | 1785 |
|
@@ -2226,6 +2230,26 @@ public void setLocation(RubyClass location) { |
2226 | 2230 | this.locationClass = location; |
2227 | 2231 | } |
2228 | 2232 |
|
| 2233 | + public RubyClass getMutex() { |
| 2234 | + return mutexClass; |
| 2235 | + } |
| 2236 | + |
| 2237 | + public RubyClass getConditionVariable() { |
| 2238 | + return conditionVariableClass; |
| 2239 | + } |
| 2240 | + |
| 2241 | + public RubyClass getQueue() { |
| 2242 | + return queueClass; |
| 2243 | + } |
| 2244 | + |
| 2245 | + public RubyClass getClosedQueueError() { |
| 2246 | + return closedQueueError; |
| 2247 | + } |
| 2248 | + |
| 2249 | + public RubyClass getSizedQueueClass() { |
| 2250 | + return sizedQueueClass; |
| 2251 | + } |
| 2252 | + |
2229 | 2253 | public RubyModule getWarning() { |
2230 | 2254 | return warningModule; |
2231 | 2255 | } |
@@ -3529,6 +3553,10 @@ public RubyString newString(String string) { |
3529 | 3553 | return RubyString.newString(this, string); |
3530 | 3554 | } |
3531 | 3555 |
|
| 3556 | + public RubyString newDeduplicatedString(String string) { |
| 3557 | + return freezeAndDedupString(RubyString.newString(this, string)); |
| 3558 | + } |
| 3559 | + |
3532 | 3560 | public RubyString newString(ByteList byteList) { |
3533 | 3561 | return RubyString.newString(this, byteList); |
3534 | 3562 | } |
@@ -5315,6 +5343,11 @@ void setException(RubyClass exceptionClass) { |
5315 | 5343 | private final RubyClass dummyClass; |
5316 | 5344 | private final RubyClass randomClass; |
5317 | 5345 | private final RubyClass dataClass; |
| 5346 | + private final RubyClass mutexClass; |
| 5347 | + private final RubyClass conditionVariableClass; |
| 5348 | + private final RubyClass queueClass; |
| 5349 | + private final RubyClass closedQueueError; |
| 5350 | + private final RubyClass sizedQueueClass; |
5318 | 5351 |
|
5319 | 5352 | private RubyClass tmsStruct; |
5320 | 5353 | private RubyClass passwdStruct; |
|
0 commit comments