[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Starting a subprocess in stopped state

From: Eli Zaretskii
Subject: Re: Starting a subprocess in stopped state
Date: Sat, 06 May 2017 10:58:22 +0300

> From: Thien-Thi Nguyen <address@hidden>
> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]