help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Accepting process output from a given process only?


From: Milan Zamazal
Subject: Re: Accepting process output from a given process only?
Date: Sun, 08 Aug 2004 20:47:46 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

>>>>> "SM" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

    >> I'd like to receive output from an asynchronous process, but
    >> without possible invocation of other asynchronous actions.  If I
    >> simply call accept-process-output, other process filter functions
    >> or timers may be invoked at that time, which is what I need to
    >> avoid.

    SM> There's no such feature.  Could you explain what you need it for
    SM> (i.e. why it is bad to process other processes's output at the
    SM> same point in the program)?

I write an Emacs speech output system, which communicates with a speech
synthesis system via a network process.  The problem is that, due to
possible multiple process processing in accept-process-output, many
process filter functions must be reentrant.

Imagine the following (real) scenario: Some Emacs command, let's say
foo, opens a network connection, reads data from the socket and reports
progress to the user via `message' in its filter function.  The
`message' function is, naturally, advised by the speech output system,
which talks to the synthesizer and reads its answer immediately, i.e. it
calls accept-process-output.  But the accept-process-output call may
invoke foo's filter function again, i.e. the foo's filter function is
invoked within its previous invocation.  If the foo's filter function is
not reentrant, foo may end up with an error.

If I could call accept-process-output in the speech output system
without the danger of other filter function and/or timer invocation,
then foo would be safe.  Moreover, the speech output system needn't be
reentrant itself, so it could be simplified.

Regards,

Milan Zamazal

-- 
The rush to reproduce Microsofts window environment seems to overshadow the
design process of determining what a window environment should be, and what its
ultimate users will want.                  -- Barry Fishman in gnu.misc.discuss





reply via email to

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