Revision: 3471 http://trac.macosforge.org/projects/ruby/changeset/3471 Author: ernest.prabhakar@gmail.com Date: 2010-02-09 15:26:12 -0800 (Tue, 09 Feb 2010) Log Message: ----------- Dispatch::Future#new should take a priority Modified Paths: -------------- MacRuby/trunk/lib/dispatch/dispatch.rb MacRuby/trunk/spec/macruby/library/dispatch/future_spec.rb MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/queue_tags.txt Modified: MacRuby/trunk/lib/dispatch/dispatch.rb =================================================================== --- MacRuby/trunk/lib/dispatch/dispatch.rb 2010-02-09 23:25:55 UTC (rev 3470) +++ MacRuby/trunk/lib/dispatch/dispatch.rb 2010-02-09 23:26:12 UTC (rev 3471) @@ -46,7 +46,8 @@ # +join+ or +value+ def fork(priority=nil, &block) - Dispatch::Future.new(priority) &block + Dispatch::Future.new(priority) { block.call } + # Can't pass block directly for some reason end module_function :label_for, :queue_for, :async, :sync, :group, :wrap, :fork Modified: MacRuby/trunk/spec/macruby/library/dispatch/future_spec.rb =================================================================== --- MacRuby/trunk/spec/macruby/library/dispatch/future_spec.rb 2010-02-09 23:25:55 UTC (rev 3470) +++ MacRuby/trunk/spec/macruby/library/dispatch/future_spec.rb 2010-02-09 23:26:12 UTC (rev 3471) @@ -13,6 +13,12 @@ it "should return a Future for tracking execution of the passed block" do @future.should be_kind_of Dispatch::Future end + + it "should take a +priority+ for which concurrent queue to use" do + future = Dispatch::Future.new(:high) { @result=Dispatch::Queue.current } + future.join + @result.to_s.should == Dispatch::Queue.concurrent(:high).to_s + end end describe :group do Modified: MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/queue_tags.txt =================================================================== --- MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/queue_tags.txt 2010-02-09 23:25:55 UTC (rev 3470) +++ MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/queue_tags.txt 2010-02-09 23:26:12 UTC (rev 3471) @@ -1,2 +1,2 @@ critical:Dispatch::Queue new raises an ArgumentError if not passed a string - +fails:Dispatch::Queue == should be true if the underlying dispatch_queues are equal
participants (1)
-
source_changes@macosforge.org