tramp-devel
[Top][All Lists]
Advanced

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

tramp itimer problem when using 'with-timeout' macro


From: tbennett
Subject: tramp itimer problem when using 'with-timeout' macro
Date: Tue, 27 Sep 2005 00:27:53 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.5 (cucumber, linux)

The following message is a courtesy copy of an article
that has been posted to gmane.emacs.xemacs.beta as well.


21.5.22 on linux

Using tramp (rsync) gives a lot of annoying '(no-catch ...' or
'(void-handler...'  messages when itimer's issued on behalf of
tramp (via 'with-timeout') fire, but the 'with-timeout' (catch
...) is no longer active.

    itimer "with-timeout<5>" signaled: (void-function with-timeout-handler)
    itimer "with-timeout<6>" signaled: (void-function with-timeout-handler)
    itimer "with-timeout<7>" signaled: (void-function with-timeout-handler)
        ...

I think this is happening when something in BODY param of
'with-timeout' does an unexpected 'throw' apart from the
catch/throw setup by 'with-timeout' and thus jumps over the
'delete-itimer' call inside 'with-timeout'.  This definitely
happens at process finish time.

This patch to 'with-timeout' macro seems to fix it:  

*** timer-funcs.el      2005/09/26 17:11:15     1.1
--- timer-funcs.el      2005/09/27 03:38:11
***************
*** 181,187 ****
        (timeout-forms (cdr list)))
      `(let ((with-timeout-tag (cons nil nil))
           with-timeout-value with-timeout-timer)
!       (when (catch with-timeout-tag
              (progn
                (setq with-timeout-timer
                      (start-itimer "with-timeout" #'with-timeout-handler
--- 181,188 ----
        (timeout-forms (cdr list)))
      `(let ((with-timeout-tag (cons nil nil))
           with-timeout-value with-timeout-timer)
!       (unwind-protect
!           (when (catch with-timeout-tag
              (progn
                (setq with-timeout-timer
                      (start-itimer "with-timeout" #'with-timeout-handler
***************
*** 189,196 ****
                (setq with-timeout-value (progn ,@body))
                nil))
            ,@timeout-forms
!           (delete-itimer with-timeout-timer)
!           with-timeout-value))))
  
  ;;;###autoload
  (defun y-or-n-p-with-timeout (prompt seconds default-value)
--- 190,198 ----
                (setq with-timeout-value (progn ,@body))
                nil))
            ,@timeout-forms
!           with-timeout-value)
!         (delete-itimer with-timeout-timer)))))
! 
  
  ;;;###autoload
  (defun y-or-n-p-with-timeout (prompt seconds default-value)


Note you must byte-compile everything that uses 'with-timeout' after
loading the new macro definition.  Ie: tramp.el, poe-xemacs.el,
bbdb.el, feedmail.el, and perhaps others.

-- 
--tony




reply via email to

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