<div dir="ltr"><div><div><div>thanks,<br><br>so i guess if i use unidirectional connection, and the reader does not expect to get an EOF()<br></div>thank i'm safe.<br><br></div>thanks,<br></div>erez.<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Jun 4, 2013 at 3:23 PM, Amos Shapira <span dir="ltr"><<a href="mailto:amos.shapira@gmail.com" target="_blank">amos.shapira@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="im">On 4 June 2013 21:43, ronys <span dir="ltr"><<a href="mailto:ronys@gmx.net" target="_blank">ronys@gmx.net</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote">
<div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Nothing. You're just wasting resources (file descriptors) and making your code a bit harder to understand and maintain.<div><br></div><div>Note that for pipe(), you can use both fds at both ends of the pipe, but it's very easy to get into a race condition.Better to open a pair of pipes, one for each direction (of course, you now need to worry about deadlocks...).</div>
</div></blockquote><div><br></div></div><div>And about this one (race conditions) - any two processes using pipes (which have limited buffer size) to talk to each other bi-directionally run the risk of a deadlock if not coded carefully since they can easily reach a point where both of them block on write(2) which will only unblock when the other side read(2)'s and frees up space in the buffer (but the other side is blocked on a write - that's why it's called a "deadlock"). Typical ways to avoid that are to create threads to watch the fd's or use none-blocking IO.</div>
<div class="im">
<div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<div><br></div><div>Rony</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Tue, Jun 4, 2013 at 2:24 PM, Erez D <span dir="ltr"><<a href="mailto:erez0001@gmail.com" target="_blank">erez0001@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><div><div><div><div><div>hello<br><br></div>using the usual pipe()+fork()+dup()+close() to fork a child process and pipe data from and to it,<br>
<br></div><div>I know both the child and parent must close the unused fds.<br>
</div></div><br>why ?<br></div>what if i don't close the unsed fds ?<br><br><br></div>thanks,<br></div>erez.<br><div><div><div><div><br></div></div></div></div></div>
<br></div></div>_______________________________________________<br>
Linux-il mailing list<br>
<a href="mailto:Linux-il@cs.huji.ac.il" target="_blank">Linux-il@cs.huji.ac.il</a><br>
<a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" target="_blank">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Ubi dubium, ibi libertas (where there is doubt, there is freedom)<br>
</font></span></div>
<br>_______________________________________________<br>
Linux-il mailing list<br>
<a href="mailto:Linux-il@cs.huji.ac.il" target="_blank">Linux-il@cs.huji.ac.il</a><br>
<a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" target="_blank">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a><br>
<br></blockquote></div></div><br><br clear="all"><div><br></div>-- <br><div class="im"><div dir="ltr">
<a href="http://www.linkedin.com/in/gliderflyer" target="_blank">
<span>
<img src="http://s4.licdn.com/scds/common/u/img/webpromo/btn_viewmy_160x25.png" alt="View my profile on LinkedIn" width="160" height="25">
</span></a></div>
</div></div></div>
</blockquote></div><br></div>