lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2013/5/14 Jose Torre-Bueno <jtorrebueno@cox.net>

On May 14, 2013, at 2:34 PM, Coda Highland <chighland@gmail.com> wrote:

> On Tue, May 14, 2013 at 2:31 PM, Jose Torre-Bueno <jtorrebueno@cox.net> wrote:
>> The question remains why does an os call create a need to flush the stdout buffer?
>
> Seems like a pretty obvious answer to me: The child process has a
> stdout stream (whether it uses it or not). When the child process
> exits, it closes its stream, which flushes stdout.
>
> /s/ Adam
>


Thanks
Do I understand you correctly that when the child process closes its stream the parent's stdout stream gets flushed to nowhere?  This seems to be the case since turning off buffering or explicitly calling flush before the os call works.  I guess I did not realize a child process could impact its parent's output stream.

I believe it's simply the effect of buffering, as Petit Abeille pointed out. On Linux, if you wait 93 seconds you'll see output. Since you write 11 bytes per second, 11*93 is a good estimate for the buffer size (1024).

--
Fidelis Assis