emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] feature/tramp-thread-safe 279618b: Do not propagate Tramp


From: Michael Albinus
Subject: [Emacs-diffs] feature/tramp-thread-safe 279618b: Do not propagate Tramp errors to the main thread
Date: Thu, 30 Aug 2018 08:30:57 -0400 (EDT)

branch: feature/tramp-thread-safe
commit 279618b685ca3e0787d65afcd8007e3ba8c565b5
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Do not propagate Tramp errors to the main thread
    
    * lisp/files.el (find-file-noselect): Use `with-demoted-errors'
    for the joined threads.
    
    * lisp/net/tramp-compat.el (tramp-compat-signal): Remove.
    
    * lisp/net/tramp.el (tramp-error, tramp-file-name-handler): Do not
    propagate the error to the main thread.
---
 lisp/files.el            |  3 ++-
 lisp/net/tramp-compat.el |  7 -------
 lisp/net/tramp.el        | 11 +++++------
 3 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index 87d7791..8ed683d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2229,7 +2229,8 @@ every file will be loaded in an own thread."
                   (with-mutex vc-mutex
                     (thread-yield)
                     (dolist (thread threads result)
-                      (setq result (cons (thread-join thread) result)))))
+                      (setq result (with-demoted-errors
+                                       (cons (thread-join thread) result))))))
 
               (mapcar #'find-file-noselect files))))
 
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index bb6fc18..2a5939f 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -250,13 +250,6 @@ If NAME is a remote file name, the local part of NAME is 
unquoted."
   "Yield the CPU to another thread."
   (tramp-compat-funcall 'thread-yield))
 
-(defsubst tramp-compat-signal (error-symbol data)
-  "Signal an error to the main thread."
-  (when tramp-compat-main-thread
-    (tramp-compat-funcall
-     'thread-signal tramp-compat-main-thread error-symbol data))
-  (signal error-symbol data))
-
 ;; Mutexes have entered Emacs 26.1.  Once we use only Emacs 26+, we
 ;; must check (mutexp mutex), because the other functions might still
 ;; not exist when Emacs is configured --without-threads.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 62c9f9a..c87cb22 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1702,7 +1702,7 @@ function is meant for debugging purposes."
   "Emit an error.
 VEC-OR-PROC identifies the connection to use, SIGNAL is the
 signal identifier to be raised, remaining arguments passed to
-`tramp-message'.  Finally, signal SIGNAL is raised to the main thread."
+`tramp-message'.  Finally, signal SIGNAL is raised."
   (let (tramp-message-show-message)
     (tramp-backtrace vec-or-proc)
     (unless arguments
@@ -1718,8 +1718,7 @@ signal identifier to be raised, remaining arguments 
passed to
        (list signal
              (get signal 'error-message)
              (apply #'format-message fmt-string arguments)))))
-    (tramp-compat-signal
-     signal (list (apply #'format-message fmt-string arguments)))))
+    (signal signal (list (apply #'format-message fmt-string arguments)))))
 
 (defsubst tramp-error-with-buffer
   (buf vec-or-proc signal fmt-string &rest arguments)
@@ -2342,8 +2341,8 @@ If Emacs is compiled --with-threads, the body is 
protected by a mutex."
                         (tramp-message
                          v 1 "Interrupt received in operation %s"
                          (cons operation args)))
-                      ;; Propagate the quit signal.
-                      (tramp-compat-signal (car err) (cdr err)))
+                      ;; Propagate the signal.
+                      (signal (car err) (cdr err)))
 
                      ;; When we are in completion mode, some failed
                      ;; operations shall return at least a default
@@ -2362,7 +2361,7 @@ If Emacs is compiled --with-threads, the body is 
protected by a mutex."
                                    '(expand-file-name file-name-as-directory)))
                         filename)
                        ;; Propagate the error.
-                       (t (tramp-compat-signal (car err) (cdr err))))))
+                       (t (signal (car err) (cdr err))))))
 
                  ;; Nothing to do for us.  However, since we are in
                  ;; `tramp-mode', we must suppress the volume letter



reply via email to

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