unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: emacs-devel@gnu.org
Cc: Daiki Ueno <ueno@gnu.org>
Subject: Re: Starting a subprocess in stopped state
Date: Sat, 06 May 2017 10:58:22 +0300	[thread overview]
Message-ID: <83bmr6fmch.fsf@gnu.org> (raw)
In-Reply-To: <87bmr6wngl.fsf@zigzag> (message from Thien-Thi Nguyen on Sat, 06 May 2017 07:42:18 +0200)

> From: Thien-Thi Nguyen <ttn@gnu.org>
> Date: Sat, 06 May 2017 07:42:18 +0200
> 
> I see the docstring for ‘make-process’ says:
> 
>  :stop BOOL -- Start process in the ‘stopped’ state if BOOL
>  non-nil.  In the stopped state, a process does not accept
>  incoming data, but you can send outgoing data.  The stopped
>  state is cleared by ‘continue-process’ and set by
>  ‘stop-process’.
> 
> My understanding is that "stopped state", given that "you can
> send outgoing data", is an Emacs-internal data routing concern
> rather than an OS-level concern (SIGTSTP).  The latter would
> completely prevent the asymmetric data feature (documented by
> "you can send outgoing data"), i'd think.

However, stop-process does send SIGTSTP to the process, and
continue-process sends SIGCONT.  The above means that the process
started with :stop non-nil will indeed run, unlike a process which was
stopped with stop-process immediately after starting it.  So there are
two flavors of "stopped" state here, one with SIGTSTP delivered to the
process, the other without.

Also, not reading the Emacs end of the pipe, while the process runs is
probably going to get is to undefined behavior in some situations,
especially with multithreaded processes.

For network or serial or pipe "process", not reading from the
descriptor is all that counts.  But for a local subprocess, this is
not so, IMO.

Is there a way to create a process on Unix and GNU systems, but
prevent it from running until it gets SIGCONT or something similar?
(There is such a way on MS-Windows.)  Debuggers do that, of course,
but I don't mean starting a process as a debugger would, since that
would be gross, and probably requires special privileges at least on
some systems.

Thanks.



  reply	other threads:[~2017-05-06  7:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 19:04 Starting a subprocess in stopped state Eli Zaretskii
2017-05-05  7:29 ` Eli Zaretskii
2017-05-06  5:42   ` Thien-Thi Nguyen
2017-05-06  7:58     ` Eli Zaretskii [this message]
2017-05-07 12:24       ` Philipp Stephani
2017-05-07 17:16         ` Eli Zaretskii
2017-05-07 17:25       ` Paul Eggert
2017-05-07 17:57         ` Eli Zaretskii
2017-05-07 18:05         ` Andreas Schwab
2017-05-08 16:41       ` Davis Herring
2017-05-08 16:46         ` Eli Zaretskii

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=83bmr6fmch.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=ueno@gnu.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).