[MacRuby-devel] [MacRuby] #664: MacRuby Crashes When Scheduling a Block to Run on the Main Thread from a Background Thread

MacRuby ruby-noreply at macosforge.org
Fri Apr 30 12:19:11 PDT 2010


#664: MacRuby Crashes When Scheduling a Block to Run on the Main Thread from a
Background Thread
---------------------------------+------------------------------------------
 Reporter:  dylan@…              |       Owner:  lsansonetti@…        
     Type:  defect               |      Status:  new                  
 Priority:  blocker              |   Milestone:                       
Component:  MacRuby              |    Keywords:                       
---------------------------------+------------------------------------------

Comment(by lsansonetti@…):

 Proc#call is currently not directly callable from C/ObjC. Can you try this
 workaround instead:

 {{{

 def main_thread( &block )
   o = Object.new
   def o.call
     @block.call
   end
   o.instance_variable_set(:@block, block)
   o.performSelectorOnMainThread( 'call', withObject: nil, waitUntilDone:
 true )
 end

 Thread.new do
   main_thread do
     [1,2,3].each {|i| puts i }
   end
 end
 }}}

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



More information about the MacRuby-devel mailing list