#420: GCD serial dispatch queues and groups that contain serial queues do not
take surrounding scope reliably within loops/enumerators
-----------------------------------+----------------------------------------
 Reporter:  johnmacs...@…          |        Owner:  lsansone...@…        
     Type:  defect                 |       Status:  closed               
 Priority:  blocker                |    Milestone:  MacRuby 0.5          
Component:  MacRuby                |   Resolution:  fixed                
 Keywords:  GCD                    |  
-----------------------------------+----------------------------------------
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.5


Comment:

 I looked at your test script, extracted the first snippet and tested it
 with ToT (r3056). It seems to work as expected. I had to modify your
 snippet to use a group in order to wait for pending blocks (otherwise the
 program exists prematurely).

 {{{
 $ cat t.rb
   lock = Dispatch::Queue.new("org.johnmacshea.lock")
   group = Dispatch::Group.new
   results = []
   100.times do |index|
     serial = Dispatch::Queue.new("org.johnmacshea.serial_#{index}")
     group.dispatch(serial) do
       sleep rand(5)
       p index
       lock.dispatch {results << "#{index}"}
     end
   end
   group.wait
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/420#comment:2>
MacRuby <http://macruby.org/>

_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to