sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
From: plexus-sys!mdash@uunet.uu.net
To: sam-fans@hawkwind.utcs.toronto.edu
Subject: 9term bug
Date: Thu, 1 Dec 1994 19:09:33 -0500	[thread overview]
Message-ID: <QQxsls17709.199412020009@relay1.UU.NET> (raw)


Has anybody else seen this race in 9term?  Here's an excerpt from
sendrunes:

        if (p > s)
                while (write(comm_fd, s, p-s) < 0 && errno == EAGAIN)
                                ;
                /* reinstate echo mode, if we disabled it above */
        if (echo) {
                ttmode.c_lflag |= ECHO;
                IOSETATTR(slave_fd, &ttmode);
        }

The IOSETATTR can race with the line discipline's processing of
characters written on comm_fd.  When the IOSETATTR beats the input
processing, some suffix of the input is echoed an extra time.

I've seen this only on some multiprocessors, but it seems theoretically
possible in other settings.  My workaround is nondeterministic, but it
works on the hosts where I've tried it.

        if (echo) {
		tcdrain(comm_fd);
                ttmode.c_lflag |= ECHO;
                IOSETATTR(slave_fd, &ttmode);
        }

Anybody got a better way to handle this?

--Mike Scheer, 908-273-1885, mdash@plexus-sys.com


             reply	other threads:[~1994-12-02  0:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-12-02  0:09 plexus-sys!mdash [this message]
1997-10-28  6:32 Scott Schwartz
1997-10-31 15:53 Bengt Kleberg
1997-11-01  0:47 ` James Matthew Farrow

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=QQxsls17709.199412020009@relay1.UU.NET \
    --to=plexus-sys!mdash@uunet.uu.net \
    --cc=sam-fans@hawkwind.utcs.toronto.edu \
    /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).