I slightly tried more with t226.rb failure,
it is timing dependent, the problem is
at the end in thread.join.
Might be bug in design of system pthread library,
too much optimizing compiler or bug in ruby thread library.
The ruby1.8_1.8.7.174-2, compiled on Aug 19 passes
the same test repeatedly fine.
Petr
begin
require "io/nonblock"
r, w = IO.pipe
w.nonblock = true
w.write_nonblock("a" * 100000)
w.nonblock = false
t1 = Thread.new { w.write("b" * 4096) }
t2 = Thread.new { w.write("c" * 4096) }
sleep 0.5
puts 'Hello ' + String(r.sysread(4096).length)
sleep 0.5
puts 'Hello ' + String(r.sysread(4096).length)
sleep 0.5
puts 'Hello ' + String(t1.join(5))
puts 'Hello ' + String(t2.join(5))
rescue LoadError
end
$ ruby1.9.1 /tmp/t226.rb
Hello 4096
Hello 4096
Hello #<Thread:0x00000000608f30>
Hello #<Thread:0x00000000608d00>
$ ruby1.9.1 /tmp/t226.rb
Hello 4096
Hello 4096
Hello
Hello #<Thread:0x00000000608d00>
$ ruby1.9.1 /tmp/t226.rb
Hello 4096
Hello 4096
Hello
Hello #<Thread:0x00000000608d00>
$ ruby1.9.1 /tmp/t226.rb
Hello 4096
Hello 4096
Hello #<Thread:0x00000000608f30>
Hello
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]