caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Török Edwin" <edwintorok@gmail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Problem with un-flushed output getting mangled
Date: Sat, 01 Oct 2011 10:11:10 +0300	[thread overview]
Message-ID: <4E86BD0E.2050203@gmail.com> (raw)
In-Reply-To: <CAAmKFxcSWWMsLk7MuOQsin9OxxXFOGaaJHj33c25m61ccoMA2A@mail.gmail.com>

On 10/01/2011 04:55 AM, Taylor Venable wrote:
> On Fri, Sep 30, 2011 at 05:45, Jerome Vouillon <vouillon@pps.jussieu.fr> wrote:
>> On Thu, Sep 29, 2011 at 08:00:47PM -0400, Taylor Venable wrote:
>>> My trouble is this: if I fail to call flush on the output channels in
>>> step #4, I get mangled output. By mangled I mean that in the middle of
>>> one line, suddenly the data from another line appears. The other line
>>> exists elsewhere in the output. Sometimes lines are simply duplicated.
>>
>> Are you using Unix.fork? When you fork, the buffers are duplicated and
>> can thus end up being flushed several times. In particular, the 'exit'
>> function from the Pervasives module flushes all open output channels.
>> I don't have a good workaround. You can call 'flush_all' before
>> forking, but any write error is silently ignored by this function.
>> Or use 'Unix.execv "/bin/true" [||]' rather than 'exit' to terminate
>> subprocesses.
> 
> Nope, I'm not forking. I also tried putting an explicit exit at the
> end of my program, but I already close_out my file before then so it
> doesn't make a difference. Thanks for the ideas, though.
> 

Do you use threads?

--Edwin

  reply	other threads:[~2011-10-01  7:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30  0:00 Taylor Venable
2011-09-30  9:45 ` Jerome Vouillon
2011-10-01  1:55   ` Taylor Venable
2011-10-01  7:11     ` Török Edwin [this message]
2011-10-03 10:51       ` Taylor Venable
2011-10-02 11:41 ` Tiphaine Turpin
     [not found] ` <CAGyUfm24stnWFHwWGt4p0gZWA72FM97aXUZTe7wo1i9WDj7nFA@mail.gmail.com>
2011-10-03 19:00   ` Pierre Chopin
2011-10-04  1:39     ` Taylor Venable

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E86BD0E.2050203@gmail.com \
    --to=edwintorok@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).