unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Timer scheduling and cancel-timer
@ 2013-01-20 15:58 Tomohiro Matsuyama
  2013-01-20 19:22 ` Paul Eggert
  0 siblings, 1 reply; 22+ messages in thread
From: Tomohiro Matsuyama @ 2013-01-20 15:58 UTC (permalink / raw)
  To: emacs-devel

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>



^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2013-03-31 16:44 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-20 15:58 Timer scheduling and cancel-timer Tomohiro Matsuyama
2013-01-20 19:22 ` 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

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