Reading a pipe by multiple threads

e$B0J2<$N%W%m%0%i%`$,e(B ^C e$B$G;_$^$j$^$;$s!#e(B

% ./ruby -ve ’
r, w = IO.pipe
t1 = Thread.new { p [1, r.sysread(10)] }
t2 = Thread.new { p [2, r.sysread(10)] }
sleep 1
w.write “a”
sleep 1
w.write “a”

ruby 1.9.0 (2007-09-25 patchlevel 0) [i686-linux]
[1, “a”]
^C

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs