emacs-devel
[Top][All Lists]
Advanced

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

24.3.50; Timer firing after being canceled


From: Michael Heerdegen
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)

Hi,

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 ()
  (interactive)
  (setq my-timer
        (run-with-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.


Thanks,

Michael.



In GNU Emacs 24.3.50.1 (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
 --with-pop=yes
 
--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.3.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3.50/site-lisp:/usr/share/emacs/site-lisp
 --without-compress-info --with-crt-dir=/usr/lib/x86_64-linux-gnu/
 --with-x=yes --with-x-toolkit=gtk3 --with-imagemagick=yes
 CFLAGS='-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2'
 CPPFLAGS='-D_FORTIFY_SOURCE=2' LDFLAGS='-g -Wl,--as-needed
 -znocombreloc''

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




reply via email to

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