From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.devel Subject: Re: sleep-for documentation and how to pause reliably Date: Fri, 15 Feb 2013 21:36:04 +0100 Organization: Emacs Helm Message-ID: <87r4khgvrf.fsf@gmail.com> References: <83mwv6szif.fsf@gnu.org> <878v6pj2vk.fsf@gmail.com> <83haldu342.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1360960582 13017 80.91.229.3 (15 Feb 2013 20:36:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Feb 2013 20:36:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 15 21:36:43 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 1U6S1T-00008I-Bn for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2013 21:36:43 +0100 Original-Received: from localhost ([::1]:35134 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6S19-0006Sp-J7 for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2013 15:36:23 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6S17-0006Qd-4B for emacs-devel@gnu.org; Fri, 15 Feb 2013 15:36:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6S13-0005Fy-0U for emacs-devel@gnu.org; Fri, 15 Feb 2013 15:36:21 -0500 Original-Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:36591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6S12-0005Fk-OU; Fri, 15 Feb 2013 15:36:16 -0500 Original-Received: by mail-wi0-f169.google.com with SMTP id l13so1831241wie.2 for ; Fri, 15 Feb 2013 12:36:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version:content-type; bh=uNDKAzfmWHPVB7mqJVRVBUEDcx4CjoRMwAsYGSmZXXs=; b=ApG9/06mJU1mBptoaI25ALqgiMDxy1194v410xIs8RbwyAwam4mLPFnhLgCLuseH7W VhFmSe7fXbXMaBiRTHbzXwG+BSZA+b3ETxiL5azFRAQItbwCVq8sReooRJuF0Hijs9oj dwYVPnmb6Oa8tWKUeJu3Cl6e8vR1gb2uxUS+lmcpqbXP2uFkBX8D35gJxaaBNMsAVg2B NKUfhnVRpt0R5Hpd/aKeROgN9o8jdAJhZM3nHf1wZbh72QDjyOjVW0qtSOGAEGWcZcAg oS0Oez+4Ud56ILyw6ec6qufyfUdnyv7uJqwa8jQrGbAfS18Pnti0qdGOYJ8hte/z4j+1 ptpQ== X-Received: by 10.180.93.234 with SMTP id cx10mr8323232wib.34.1360960575508; Fri, 15 Feb 2013 12:36:15 -0800 (PST) Original-Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id ek4sm6907096wib.11.2013.02.15.12.36.13 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 15 Feb 2013 12:36:13 -0800 (PST) In-Reply-To: <83haldu342.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 15 Feb 2013 15:18:53 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.93 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::229 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:157062 Archived-At: Eli Zaretskii writes: >> 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. Ok. I tried to run the initial example you sent: (progn (setq proc (start-process-shell-command "ls" nil "ls")) (sleep-for 20) (message "hi")) and I noticed that the first time I eval the code Emacs wait for 20s as expected and on next evaluations it send the message "Hi" immediately unless I run `list-processes', wait some seconds and reeval it. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997