# Reading a pipe by multiple threads

**URL:** <https://www.ruby-forum.com/t/reading-a-pipe-by-multiple-threads/115540>\
**Category:** Development\
**Created:** [September 26, 2007, 3:19am UTC](https://www.ruby-forum.com/t/reading-a-pipe-by-multiple-threads/115540 "2007-09-26T03:19:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [September 26, 2007, 3:19am UTC](https://www.ruby-forum.com/t/reading-a-pipe-by-multiple-threads/115540/1 "2007-09-26T03:19:27Z")

</div>

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
