<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 6, 2013 at 5:04 PM, E.S. Rosenberg <span dir="ltr"><<a href="mailto:esr@g.jct.ac.il" target="_blank">esr@g.jct.ac.il</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2013/6/6 Erez D <<a href="mailto:erez0001@gmail.com">erez0001@gmail.com</a>>:<br>
<div class="im">><br>
><br>
><br>
> On Tue, Jun 4, 2013 at 6:09 PM, Shachar Shemesh <<a href="mailto:shachar@shemesh.biz">shachar@shemesh.biz</a>> wrote:<br>
>><br>
>> On 04/06/13 15:28, Erez D wrote:<br>
>><br>
>> thanks,<br>
>><br>
>> so i guess if i use unidirectional connection, and the reader does not<br>
>> expect to get an EOF()<br>
>> thank i'm safe.<br>
>><br>
>> Why are you so keen on doing it wrong?<br>
>><br>
>> No, you are not safe. If the child process dies because of a segmentation<br>
>> fault (or whatever), the parent will notice this through the EOF received (I<br>
>> am assuming here, since you couldn't be bothered with closing a file<br>
>> descriptor, that you did not install a SIGCHLD handler to monitor for this<br>
>> possibility). This means that should one process die unexpectedly, the other<br>
>> will hang forever.<br>
><br>
> it's not a matter of being bothered. closing a file has it's implications<br>
><br>
> 1. close the file for one thread closes for all<br>
</div>thread and fork are 2 very different things, best practice for fork<br>
('full' children, I think everyone understands fork() when you say<br>
child) is to close, when using threads that is I believe not the case.<br>
<div class="im">> 2. what if i want later children using the same pipe, as in all childs write<br>
> to same pipe read by parent...<br>
</div>so the children are all closing the read end and the parent only<br>
closes write, where is the problem?<br></blockquote><div>if the parent closes the "write" side, then new forked children have their "write" side already closed. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im HOEnZb">><br>
>><br>
>> Best practices are there for a reason, despite what others here might have<br>
>> you think.<br>
>><br>
>> Shachar<br>
><br>
><br>
><br>
</div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> Linux-il mailing list<br>
> <a href="mailto:Linux-il@cs.huji.ac.il">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>
</div></div></blockquote></div><br></div></div>