[macruby-changes] [4734] DietRB/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Oct 8 04:07:02 PDT 2010


Revision: 4734
          http://trac.macosforge.org/projects/ruby/changeset/4734
Author:   eloy.de.enige at gmail.com
Date:     2010-10-08 04:07:01 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
Move the grouping of threads to IRB::Driver.current=

From: Eloy Duran <eloy.de.enige at gmail.com>

Modified Paths:
--------------
    DietRB/trunk/lib/irb/driver/tty.rb
    DietRB/trunk/lib/irb/driver.rb
    DietRB/trunk/spec/driver_spec.rb

Modified: DietRB/trunk/lib/irb/driver/tty.rb
===================================================================
--- DietRB/trunk/lib/irb/driver/tty.rb	2010-10-08 11:06:51 UTC (rev 4733)
+++ DietRB/trunk/lib/irb/driver/tty.rb	2010-10-08 11:07:01 UTC (rev 4734)
@@ -8,9 +8,6 @@
       def initialize(input = $stdin, output = $stdout)
         @input  = input
         @output = output
-        
-        @thread_group = ThreadGroup.new
-        @thread_group.add(Thread.current)
       end
       
       def readline(context)

Modified: DietRB/trunk/lib/irb/driver.rb
===================================================================
--- DietRB/trunk/lib/irb/driver.rb	2010-10-08 11:06:51 UTC (rev 4733)
+++ DietRB/trunk/lib/irb/driver.rb	2010-10-08 11:07:01 UTC (rev 4734)
@@ -2,6 +2,7 @@
   module Driver
     class << self
       def current=(driver)
+        ThreadGroup.new.add(Thread.current)
         Thread.current[:irb_driver] = driver
       end
       

Modified: DietRB/trunk/spec/driver_spec.rb
===================================================================
--- DietRB/trunk/spec/driver_spec.rb	2010-10-08 11:06:51 UTC (rev 4733)
+++ DietRB/trunk/spec/driver_spec.rb	2010-10-08 11:07:01 UTC (rev 4734)
@@ -20,6 +20,10 @@
   end
   
   it "returns the same driver for child threads" do
+    Thread.new do
+      IRB::Driver.current = other = StubDriver.new
+      Thread.new { IRB::Driver.current.should == other }.join
+    end.join
     Thread.new { IRB::Driver.current.should == @driver }.join
   end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/e3117cb6/attachment-0001.html>


More information about the macruby-changes mailing list