#597: Dispatch Queue async method inconsistent results
--------------------------------------+-------------------------------------
 Reporter:  knut.olaf.l...@…          |       Owner:  lsansone...@…        
     Type:  defect                    |      Status:  new                  
 Priority:  blocker                   |   Milestone:                       
Component:  MacRuby                   |    Keywords:  GCD async method     
--------------------------------------+-------------------------------------
 Trying to run this:

 ## Fibionti example showing Grand Central Dispatch in action
 ## using MacRuby
 ## Feb. 2, 2010

 def fib(n=1)
   if n < 3
     1
   else
     fib(n-1) + fib(n-2)
   end
 end

 q = Dispatch::Queue.concurrent
 grp = Dispatch::Group.new

 result = []

 8.times do |index|
   q.async(grp) do
     result[index] = fib(ARGV[0].to_i)
   end
 end

 ## Wait for the result to be calculated and print the results
 grp.wait
 puts result

 Gives inconsistent fibionati results, i.e. some of the values become false
 instead of the correct fibionati number. No clue if this is a bug or just
 my implementation is wrong.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/597>
MacRuby <http://macruby.org/>

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to