all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@gmail.com>
To: Perry Smith <pedzsan@gmail.com>
Cc: help-gnu-emacs List <help-gnu-emacs@gnu.org>
Subject: Re: waiting for asynchronous processes
Date: Sun, 16 Oct 2011 00:24:52 +0200	[thread overview]
Message-ID: <87hb39zydn.fsf@gmail.com> (raw)
In-Reply-To: <C218972F-12B5-4044-BA25-1ECC959E9A34@gmail.com> (Perry Smith's message of "Sat, 15 Oct 2011 12:20:44 -0500")

On Sat, 15 Oct 2011 19:20:44 +0200
Perry Smith wrote:

> I started looking for a built in way to wait for an asynchronous command to
> complete and discovered that I had written one long long time ago in a galaxy
> far far away.
>
>> (defun wait-for-async-process ( proc )
>>   "Wait for PROC to finish"
>>   (while (null (eq (process-status proc) 'exit))
>>     (accept-process-output)))

Looks like a terrible hack to me.

> I went ahead and looked for something like it in the distribution but didn't see it.
>
> I'm curious if I overlooked it.

I doubt it. If you want to wait for the process in the way you seem to
want to wait for it, why don't you just use a synchronous process to
begin with? If you _do_ want the non-waiting advantage of asynchronous
processes, the usual way to handle state changes (s.a. when the process
finishes) is to use sentinels, see e.g. (info "(elisp)Sentinels").

-- 
Štěpán



  reply	other threads:[~2011-10-15 22:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-15 17:20 waiting for asynchronous processes Perry Smith
2011-10-15 22:24 ` Štěpán Němec [this message]
2011-10-16  0:17   ` Perry Smith
2011-10-16  1:15     ` Štěpán Němec
2011-10-16  1:49       ` Perry Smith
2011-10-16  9:16         ` Štěpán Němec
2011-10-16 12:49           ` Perry Smith
2011-10-16  9:21         ` Thien-Thi Nguyen

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=87hb39zydn.fsf@gmail.com \
    --to=stepnem@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=pedzsan@gmail.com \
    /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.