From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: sleep-for documentation and how to pause reliably Date: Fri, 15 Feb 2013 15:18:53 +0200 Message-ID: <83haldu342.fsf@gnu.org> References: <83mwv6szif.fsf@gnu.org> <878v6pj2vk.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1360934330 9893 80.91.229.3 (15 Feb 2013 13:18:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Feb 2013 13:18:50 +0000 (UTC) Cc: emacs-devel@gnu.org To: Thierry Volpiatto Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 15 14:19:07 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U6LBz-0006ey-KO for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2013 14:19:07 +0100 Original-Received: from localhost ([::1]:51930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6LBf-0001xd-S7 for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2013 08:18:47 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6LBX-0001eW-Tb for emacs-devel@gnu.org; Fri, 15 Feb 2013 08:18:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6LBW-0001uN-BH for emacs-devel@gnu.org; Fri, 15 Feb 2013 08:18:39 -0500 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:49964) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6LBV-0001tk-PG for emacs-devel@gnu.org; Fri, 15 Feb 2013 08:18:38 -0500 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MI900G00JINI400@a-mtaout23.012.net.il> for emacs-devel@gnu.org; Fri, 15 Feb 2013 15:18:35 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MI900GC7JMZ7TB0@a-mtaout23.012.net.il>; Fri, 15 Feb 2013 15:18:35 +0200 (IST) In-reply-to: <878v6pj2vk.fsf@gmail.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.175 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157048 Archived-At: > From: Thierry Volpiatto > Date: Fri, 15 Feb 2013 11:19:27 +0100 > > > Am I missing something? If not, apart of fixing the docs, _is_ there > > any way to wait reliably when async subprocesses are running and > > producing output? > What about using a sentinel? > > (progn > (let ((proc (start-process-shell-command "ls" nil "ls"))) > (set-process-sentinel proc #'(lambda (process event) > (when (string= event "finished\n")) > (sleep-for 20) > (message "hi after 20s sleeping")))) > (message "Hi now sleeping 20s")) Thanks, but that's not what I meant. I meant, suppose you must reliably wait in a Lisp program that doesn't launch any subprocesses, but should always wait for N seconds even if there are some async subprocesses running in parallel. IOW, the code that must pause doesn't itself launch any subprocesses, it just needs to wait.