all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Cc: Daiki Ueno <ueno@gnu.org>
Subject: Re: Starting a subprocess in stopped state
Date: Sun, 07 May 2017 12:24:33 +0000	[thread overview]
Message-ID: <CAArVCkSSu_uOvCap_ADGjo4ODNUveqa3c3Nb-5xOtqQoxZJnag@mail.gmail.com> (raw)
In-Reply-To: <83bmr6fmch.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2045 bytes --]

Eli Zaretskii <eliz@gnu.org> schrieb am Sa., 6. Mai 2017 um 09:59 Uhr:

> > 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?


It's at least theoretically possible on macOS using posix_spawn(3) and
POSIX_SPAWN_START_SUSPENDED (
https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man3/posix_spawnattr_setflags.3.html).
I don't think it's possible using fork/exec (but then, switching to
posix_spawn might be a good idea anyway).

[-- Attachment #2: Type: text/html, Size: 2681 bytes --]

  reply	other threads:[~2017-05-07 12:24 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
2017-05-07 12:24       ` Philipp Stephani [this message]
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

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

  git send-email \
    --in-reply-to=CAArVCkSSu_uOvCap_ADGjo4ODNUveqa3c3Nb-5xOtqQoxZJnag@mail.gmail.com \
    --to=p.stephani2@gmail.com \
    --cc=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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.