[erlang-questions] file:open's delayed_write behavior does not correspond to docs.

sand <>
Tue Feb 20 07:35:43 CET 2007


I have opened a port using

  file:open("/path/to/file", [append, raw, delayed_write])

and the process holding open the port receives messages, converts them
to IOdata, and sends them to the port using file:write/2.  According
to the Erlang documentation, the port should write its data when

  * 64kB of output data have accumulated, or
  * when the oldest datum in the buffer reaches 2 seconds old

This is thanks to the default 'delayed_write' parameters.

My program's output turns out to be consistenly one message behind the
messages being sent.  The first message "disappears" until I send the
second message, at which point it appears in the file.  When I send
the third message, the second one appears in the file, etc.  The last
message only appears when closing the file.  The 2 second limit
doesn't seem to have any effect.

Has anyone encountered this behavior before?  It's R11B-2 running on
Linux.

Thanks,

Derek

-- 
Derek Upham




More information about the erlang-questions mailing list