lstream writing, flushing, & closing

Michael Sperber sperber at deinprogramm.de
Thu Jan 3 03:56:07 EST 2008


Hi Jerry, 

this was still sitting around in my e-mail.  What ever happened with
this patch?  (It doesn't seem to've gotten applied.)

Jerry James <james at xemacs.org> writes:

> Adrian Aichner <adrian at xemacs.org> wrote:
>> Since I reverted my own patch to close handles, and built with Ben's
>> megapatch implementing a corrected version thereof, I have not seen
>> these uninterruptible hangs.  I've been using XEmacs every day and
>> kept it running for many days so I should have ween them.
>>
>> Thanks Ben!
>
> [snip]
>
>> It probably was not your patch after all, as stated above.
>
> Well ... great!  Would you mind trying my patch again, then?  For
> convenience, here it is:
>
> Index: lstream.c
> ===================================================================
> RCS file: /pack/xemacscvs/XEmacs/xemacs/src/lstream.c,v
> retrieving revision 1.31
> diff -d -u -r1.31 lstream.c
> --- lstream.c	2004/11/12 17:16:30	1.31
> +++ lstream.c	2004/11/29 04:42:28
> @@ -778,8 +778,21 @@
>  static int
>  Lstream_pseudo_close (Lstream *lstr)
>  {
> +  int flush_rc;
> +
>    if (! (lstr->flags & LSTREAM_FL_IS_OPEN))
>      Lstream_internal_error ("lstream is not open", lstr);
> +
> +  /* Flush all the data in the buffer before closing.
> +     May require multiple passes thru Lstream_flush_out().
> +     This loop (instead of just calling Lstream_flush_out(),
> +     fixes a problem where we sometimes lose data sent to
> +     a process.
> +  */
> +
> +  do {
> +    flush_rc = Lstream_flush_out(lstr);
> +  } while (lstr->out_buffer_ind > 0 && flush_rc >= 0);
>  
>    /* don't check errors here -- best not to risk file descriptor loss */
>    return Lstream_flush (lstr);
>
> If the hangs return, then we can try the approach of figuring out what
> data is getting lost here and where it was supposed to go.
>
> Thanks,
> -- 
> Jerry James
> http://www.ittc.ku.edu/~james/
>

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla



More information about the XEmacs-Beta mailing list