Revision: 3469 http://trac.macosforge.org/projects/ruby/changeset/3469 Author: ernest.prabhakar@gmail.com Date: 2010-02-09 15:25:29 -0800 (Tue, 09 Feb 2010) Log Message: ----------- Don't pass a priority to Dispatch::Future, to better match Group Modified Paths: -------------- MacRuby/trunk/lib/dispatch/future.rb MacRuby/trunk/spec/macruby/library/dispatch/dispatch_spec.rb MacRuby/trunk/spec/macruby/library/dispatch/future_spec.rb Modified: MacRuby/trunk/lib/dispatch/future.rb =================================================================== --- MacRuby/trunk/lib/dispatch/future.rb 2010-02-09 23:25:06 UTC (rev 3468) +++ MacRuby/trunk/lib/dispatch/future.rb 2010-02-09 23:25:29 UTC (rev 3469) @@ -6,11 +6,11 @@ class Future < Dispatch::Group # Create a future that asynchronously dispatches the block - # to a concurrent queue of the specified (optional) +priority+ - def initialize(priority=nil, &block) + # to the default queue + def initialize(&block) super @value = nil - Dispatch.group(self, priority) { @value = block.call } + Dispatch.group(self, nil) { @value = block.call } end # Waits for the computation to finish @@ -34,8 +34,8 @@ # (optional) +priority+ as part of a Future, which is returned for use with # +join+ or +value+ -- or as a Group, of which it is a subclass - def fork(priority=nil, &block) - Dispatch::Future.new(priority) &block + def fork(&block) + Dispatch::Future.new &block end module_function :fork Modified: MacRuby/trunk/spec/macruby/library/dispatch/dispatch_spec.rb =================================================================== --- MacRuby/trunk/spec/macruby/library/dispatch/dispatch_spec.rb 2010-02-09 23:25:06 UTC (rev 3468) +++ MacRuby/trunk/spec/macruby/library/dispatch/dispatch_spec.rb 2010-02-09 23:25:29 UTC (rev 3469) @@ -80,7 +80,7 @@ g = Dispatch.fork { @actee.delay_set(42) } $dispatch_gval.should == 0 g.should be_kind_of Dispatch::Future - #g.join + g.join $dispatch_gval.should == 42 end @@ -89,7 +89,7 @@ g = Dispatch.fork { @actee.delay_set(42) } $dispatch_gval.should == 0 g.should be_kind_of Dispatch::Group - #g.wait + g.wait $dispatch_gval.should == 42 end end Modified: MacRuby/trunk/spec/macruby/library/dispatch/future_spec.rb =================================================================== --- MacRuby/trunk/spec/macruby/library/dispatch/future_spec.rb 2010-02-09 23:25:06 UTC (rev 3468) +++ MacRuby/trunk/spec/macruby/library/dispatch/future_spec.rb 2010-02-09 23:25:29 UTC (rev 3469) @@ -20,7 +20,7 @@ end describe :join do - it "should wait until execution is complete" + it "should wait until execution is complete" do @result.should == 0 @future.join @result.should == 2**5
participants (1)
-
source_changes@macosforge.org