From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tomohiro Matsuyama Newsgroups: gmane.emacs.devel Subject: Timer scheduling and cancel-timer Date: Mon, 21 Jan 2013 00:58:02 +0900 Message-ID: <20130121005802.c7383f4994ead287e738f96f@cx4a.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1358697491 1461 80.91.229.3 (20 Jan 2013 15:58:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Jan 2013 15:58:11 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 20 16:58:30 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 1TwxHx-0000Rg-I8 for ged-emacs-devel@m.gmane.org; Sun, 20 Jan 2013 16:58:29 +0100 Original-Received: from localhost ([::1]:40453 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwxHg-0004bX-Ne for ged-emacs-devel@m.gmane.org; Sun, 20 Jan 2013 10:58:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwxHd-0004a8-MS for emacs-devel@gnu.org; Sun, 20 Jan 2013 10:58:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwxHb-0006fl-AG for emacs-devel@gnu.org; Sun, 20 Jan 2013 10:58:09 -0500 Original-Received: from www6399u.sakura.ne.jp ([59.106.183.193]:53675 helo=cx4a.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwxHb-0006eh-2P for emacs-devel@gnu.org; Sun, 20 Jan 2013 10:58:07 -0500 Original-Received: from thinkpad (EM117-55-68-173.emobile.ad.jp [117.55.68.173]) by cx4a.org (Postfix) with ESMTPSA id 91C3186B3F for ; Mon, 21 Jan 2013 00:58:01 +0900 (JST) X-Mailer: Sylpheed 3.2.0 (GTK+ 2.24.13; x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 59.106.183.193 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:156498 Archived-At: Hi, I have found a problem that cancel-timer will not work in a particular situation where the timer takes more time to execute than a rescheduling interval of the timer. Here is the reproducible code: (setq my-timer (run-with-timer nil 0.1 (lambda () (when my-timer (cancel-timer my-timer) (setq my-timer nil) (sit-for 0.3))))) After evaluating this code several times, you may see "zombie" timers in timer-list, though the code intends to keep at most one timer. As my quick look, the problem may be caused by timer_check in keyboard.c by firing the timer twice at the same time, that makes the timer remain in timer-list though the timer has been canceled. Regards, Tomohiro -- Tomohiro Matsuyama