[MacRuby] #954: Race condition: assertion fails with IO.pipe, when checks size of String which had read from pipe. (was: Assertion fails with IO.pipe, when checks size of String which had read from pipe.)

MacRuby ruby-noreply at macosforge.org
Tue Oct 12 13:54:47 PDT 2010


#954: Race condition: assertion fails with IO.pipe, when checks size of String
which had read from pipe.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------

Comment(by lsansonetti@…):

 The following works:

 {{{
 r, w = IO.pipe
 s = ""
 t = Thread.new { r.read(5, s) }
 w.write "foobarbaz"
 sleep 0.5

 true until s.size == 5 # crash
 p t.value
 p s
 }}}

 The problem is that the same string object cannot be passed to IO#read and
 perform String#size at the same time.

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



More information about the macruby-tickets mailing list