unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: 16737@debbugs.gnu.org
Subject: bug#16737: Question about wait_reading_process_output
Date: Mon, 15 Jun 2015 21:04:44 +0300	[thread overview]
Message-ID: <83eglconk3.fsf@gnu.org> (raw)
In-Reply-To: <87pp4xeym8.fsf@linaro.org>

> From: Alex Bennée <alex.bennee@linaro.org>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 16737@debbugs.gnu.org
> Date: Mon, 15 Jun 2015 17:15:59 +0100
> 
> > The terminal socket reads are run in gobble_input, which is called
> > from detect_input_pending (via a few intermediaries).  Emacs calls
> > detect_input_pending when the pselect call in
> > wait_reading_process_output finds that some input has arrived, and
> > wait_reading_process_output was called with READ_KBD or WAIT_FOR_CELL
> > arguments having values that tell it to do so.
> >
> > Does this answer your question?
> 
> Sort of. One thing that's confusing is there are two pselect() calls in
> the function:
> 
> 	  if ((pselect (max (max_process_desc, max_input_desc) + 1,
> 			&Atemp,
> #ifdef NON_BLOCKING_CONNECT
> 			(num_pending_connects > 0 ? &Ctemp : NULL),
> #else
> 			NULL,
> #endif
> 			NULL, &timeout, NULL)
> 	       <= 0))
> 
> and
> 
> #if defined (HAVE_NS)
>           nfds = ns_select
> #elif defined (HAVE_GLIB)
> 	  nfds = xg_select
> #else
> 	  nfds = pselect
> #endif
>             (max (max_process_desc, max_input_desc) + 1,
>              &Available,
>              (check_write ? &Writeok : 0),
>              NULL, &timeout, NULL);
> 
> Why the two?

They watch different (but not orthogonal) sets of channels.

> Could there be a case where one is triggering handling so
> that the second never gets evaluated?

There's no 'continue;' between the 2 calls to 'pselect', so I don't
see how this could happen.

But it's much easier to put a breakpoint at each call to 'pselect',
which just announces itself and continues, or increments some counter,
than reason about that humongous loop.  Then you'd see very quickly if
the scenario that bothers you can actually happen.

> Am I right in thinking all incoming X messages (such as those associated
> with cut/paste) will come in via the X terminals gobble_input?

I think so, but I don't really know, sorry.





      reply	other threads:[~2015-06-15 18:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <874mmmbi2p.fsf@linaro.org>
     [not found] ` <jwvr3pdk51f.fsf-monnier+emacs@gnu.org>
2015-06-15  8:23   ` bug#16737: Question about wait_reading_process_output Tassilo Horn
2015-06-15 14:51   ` Eli Zaretskii
2015-06-15 16:02     ` Alex Bennée
2015-06-15 16:15     ` Alex Bennée
2015-06-15 18:04       ` Eli Zaretskii [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83eglconk3.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=16737@debbugs.gnu.org \
    --cc=alex.bennee@linaro.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).