[erlang-questions] Flush "stdout" buffer

Per Hedeland per@REDACTED
Sat Sep 2 11:55:51 CEST 2017


On 2017-09-02 08:42, Frank Muller wrote:
> Hi Per,
> 
> Hmmm ... So If i understand it well, we've no control on that after all.
> The data can still be buffered on the kernel side.

Yes, just like it can when you call fflush() in C. C stdio implements a
user-level buffer where the result of your fprintf() etc call goes -
fflush() does a write(2)/writev(2) call with the contents of that
buffer. That's as far as you get with *any* language executing outside
the kernel, and for non-disk I/O it's really all that you need - for
disk I/O you may want to consider fsync(2) in rare cases, available in
Erlang as file:sync/1, but irrelevant for non-disk I/O.

You still haven't said what observed problem you want to solve...

--Per



More information about the erlang-questions mailing list