unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tomohiro Matsuyama <tomo@cx4a.org>
To: emacs-devel@gnu.org
Subject: Timer scheduling and cancel-timer
Date: Mon, 21 Jan 2013 00:58:02 +0900	[thread overview]
Message-ID: <20130121005802.c7383f4994ead287e738f96f@cx4a.org> (raw)

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 <tomo@cx4a.org>



             reply	other threads:[~2013-01-20 15:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-20 15:58 Tomohiro Matsuyama [this message]
2013-01-20 19:22 ` Timer scheduling and cancel-timer Paul Eggert
2013-01-20 21:04   ` Drew Adams
2013-01-20 21:35     ` Drew Adams
2013-01-21  1:36     ` Stefan Monnier
2013-01-21  1:39       ` Drew Adams
2013-01-22  3:50         ` Drew Adams
2013-01-22 11:28           ` Stephen Berman
2013-01-22 16:00             ` Stephen Berman
2013-01-22 16:09               ` Bastien
2013-01-23  9:32                 ` Bastien
2013-01-23 13:03                   ` Stefan Monnier
2013-01-23 13:29                     ` Bastien
2013-01-23 20:35                       ` Stefan Monnier
2013-01-23 22:01                         ` Bastien
2013-01-24 16:32               ` Drew Adams
2013-01-24 19:02                 ` Bastien
2013-01-22 13:34           ` Stefan Monnier
2013-01-22 13:57             ` Bastien
2013-01-22 14:14               ` Stefan Monnier
2013-03-31 11:17   ` Tomohiro Matsuyama
2013-03-31 16:44     ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130121005802.c7383f4994ead287e738f96f@cx4a.org \
    --to=tomo@cx4a.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).