[Top][All Lists]

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

bug#14156: 24.3.50; Timer firing after being canceled

From: Stefan Monnier
Subject: bug#14156: 24.3.50; Timer firing after being canceled
Date: Sun, 07 Apr 2013 20:50:37 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Submitting it as a bug-report


--- Begin Message --- Subject: 24.3.50; Timer firing after being canceled Date: Sun, 07 Apr 2013 21:53:24 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

This report is about the following problem (bug) raised in
gnu.emacs.devel by Tomohiro Matsuyama:

| 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.

I can reproduce this problem.  And I have a test case that proves that
timers that have been canceled (i.e., removed from `timer-list') are
still called from C:

--8<---------------cut here---------------start------------->8---
(defvar my-timer nil)

(defun start-the-timer ()
  (setq my-timer
         0 0.1
         (lambda ()
           (cancel-timer my-timer)
           (sit-for 0.3)))))

(advice-add 'timer-event-handler :before
            (lambda (timer)
              (when (and (eq timer my-timer)
                         (not (memq my-timer timer-list)))
                (message "Why is this ever reached?"))))
--8<---------------cut here---------------end--------------->8---

If you call `start-the-timer', you get the message "Why is this ever
reached?" over and over.  This obviously should not happen.



In GNU Emacs (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)
 of 2013-04-04 on dex, modified by Debian
 (emacs-snapshot package, version 2:20130403-1)
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
System Description:     Debian GNU/Linux 7.0 (wheezy)

Configured using:
 `configure --build x86_64-linux-gnu --host x86_64-linux-gnu
 --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man
 --without-compress-info --with-crt-dir=/usr/lib/x86_64-linux-gnu/
 --with-x=yes --with-x-toolkit=gtk3 --with-imagemagick=yes

Important settings:
  value of $LC_ALL: de_DE.utf8
  value of $LC_TIME: C
  value of $LANG: de_DE.utf8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Dired by name

--- End Message ---

reply via email to

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