* bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
@ 2009-08-16 1:58 Chong Yidong
2009-08-17 15:36 ` Stefan Monnier
[not found] ` <mailman.4807.1250524020.2239.bug-gnu-emacs@gnu.org>
0 siblings, 2 replies; 7+ messages in thread
From: Chong Yidong @ 2009-08-16 1:58 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 2930, Markus Triska
> The documentation for sentinels states:
>
> A program can wait, so that sentinels will run, by calling
> `sit-for' or `sleep-for' (...), or `accept-process-output' (...).
>
> However, when I do M-x eval-region RET on the following forms in
> "emacs -Q", then Emacs loops unexpectedly:
>
> (defun my-sentinel (proc str)
> (setq my-finished t))
>
> (let ((p (start-process "bc" nil "bc"))
> my-finished)
> (set-process-sentinel p 'my-sentinel)
> (process-send-string p "quit\n")
> (while (not my-finished)
> (accept-process-output nil 0.1)))
The trouble is that accept-process-output passes a zero DO_DISPLAY
argument to wait_reading_process_output (process.c:4306). When
DO_DISPLAY is zero, status notifications are not performed
(process.c:4763).
Having accept-process-output pass a non-zero DO_DISPLAY argument to
wait_reading_process_output fixes this problem, but I don't know what
ramifications this would have.
Stefan, WDYT?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
2009-08-16 1:58 bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels Chong Yidong
@ 2009-08-17 15:36 ` Stefan Monnier
2009-08-17 21:04 ` Chong Yidong
[not found] ` <mailman.4807.1250524020.2239.bug-gnu-emacs@gnu.org>
1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2009-08-17 15:36 UTC (permalink / raw)
To: Chong Yidong; +Cc: 2930, Markus Triska
>> The documentation for sentinels states:
>> A program can wait, so that sentinels will run, by calling
>> `sit-for' or `sleep-for' (...), or `accept-process-output' (...).
>>
>> However, when I do M-x eval-region RET on the following forms in
>> "emacs -Q", then Emacs loops unexpectedly:
>>
>> (defun my-sentinel (proc str)
>> (setq my-finished t))
>>
>> (let ((p (start-process "bc" nil "bc"))
>> my-finished)
>> (set-process-sentinel p 'my-sentinel)
>> (process-send-string p "quit\n")
>> (while (not my-finished)
>> (accept-process-output nil 0.1)))
> The trouble is that accept-process-output passes a zero DO_DISPLAY
> argument to wait_reading_process_output (process.c:4306). When
> DO_DISPLAY is zero, status notifications are not performed
> (process.c:4763).
> Having accept-process-output pass a non-zero DO_DISPLAY argument to
> wait_reading_process_output fixes this problem, but I don't know what
> ramifications this would have.
I don't know. You already changed it in that direction a year ago:
timestamp: Mon 2008-05-19 22:29:33 +0000
message:
(wait_reading_process_output): Always check status when in batch mode.
so maybe we should change it even further? I think a good change would
be to change the code of wait_reading_process_output such that status
changes are taken into account (even when do_display is 0) but only for
the process(es) for which we're waiting.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
2009-08-17 15:36 ` Stefan Monnier
@ 2009-08-17 21:04 ` Chong Yidong
0 siblings, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2009-08-17 21:04 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 2930, Markus Triska
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> I don't know. You already changed it in that direction a year ago:
>
> timestamp: Mon 2008-05-19 22:29:33 +0000
> message:
> (wait_reading_process_output): Always check status when in batch mode.
>
> so maybe we should change it even further? I think a good change would
> be to change the code of wait_reading_process_output such that status
> changes are taken into account (even when do_display is 0) but only for
> the process(es) for which we're waiting.
OK, thanks for reminding me about Bug#131. After re-reading that
discussion, I'm fairly sure that TRT is for wait_reading_process_output
to always check the process status (without triggering a redisplay
unless DO_DISPLAY is non-zero). I've checked the change into CVS.
^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <mailman.4807.1250524020.2239.bug-gnu-emacs@gnu.org>]
* bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
[not found] ` <mailman.4807.1250524020.2239.bug-gnu-emacs@gnu.org>
@ 2009-08-17 16:34 ` Markus Triska
0 siblings, 0 replies; 7+ messages in thread
From: Markus Triska @ 2009-08-17 16:34 UTC (permalink / raw)
To: gnu-emacs-bug
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> so maybe we should change it even further? I think a good change would
> be to change the code of wait_reading_process_output such that status
> changes are taken into account (even when do_display is 0) but only for
> the process(es) for which we're waiting.
I agree, and I think that if no process at all is specified, then all
status changes should be processed. This is for consistency with regular
input processing: If there is input from some process, and no particular
process is specified, it will also be processed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
@ 2009-04-08 18:30 Markus Triska
2009-04-08 21:11 ` Stefan Monnier
[not found] ` <mailman.4941.1239225840.31690.bug-gnu-emacs@gnu.org>
0 siblings, 2 replies; 7+ messages in thread
From: Markus Triska @ 2009-04-08 18:30 UTC (permalink / raw)
To: emacs-pretest-bug
The documentation for sentinels states:
A program can wait, so that sentinels will run, by calling
`sit-for' or `sleep-for' (...), or `accept-process-output' (...).
However, when I do M-x eval-region RET on the following forms in
"emacs -Q", then Emacs loops unexpectedly:
(defun my-sentinel (proc str)
(setq my-finished t))
(let ((p (start-process "bc" nil "bc"))
my-finished)
(set-process-sentinel p 'my-sentinel)
(process-send-string p "quit\n")
(while (not my-finished)
(accept-process-output nil 0.1)))
When I replace the call of `accept-process-output' with (sleep-for
0.1), it also does not run the sentinel. (sit-for 0.1) works as
documented, but is not a good alternative for the other functions in
this case: If keyboard input is available, `sit-for' returns
immediately, so it is currently unfortunately also necessary to
discard keyboard input to make such a loop reliably run the sentinel.
In GNU Emacs 23.0.92.2 (i386-apple-darwin9.6.1, GTK+ Version 2.14.7)
of 2009-04-05 on mt-imac.local
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
configured using `configure '--with-tiff=no''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: utf-8-unix
default-enable-multibyte-characters: t
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-08-17 21:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-16 1:58 bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels Chong Yidong
2009-08-17 15:36 ` Stefan Monnier
2009-08-17 21:04 ` Chong Yidong
[not found] ` <mailman.4807.1250524020.2239.bug-gnu-emacs@gnu.org>
2009-08-17 16:34 ` Markus Triska
-- strict thread matches above, loose matches on Subject: below --
2009-04-08 18:30 Markus Triska
2009-04-08 21:11 ` Stefan Monnier
[not found] ` <mailman.4941.1239225840.31690.bug-gnu-emacs@gnu.org>
2009-04-08 21:29 ` Markus Triska
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.