[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 2f65525: Jsonrpc error handlers can now safely call
From: |
João Távora |
Subject: |
[Emacs-diffs] master 2f65525: Jsonrpc error handlers can now safely call jsonrpc-shutdown |
Date: |
Sun, 16 Dec 2018 11:55:52 -0500 (EST) |
branch: master
commit 2f65525774b6e7edf119db678c9eb78cbb84de6a
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Jsonrpc error handlers can now safely call jsonrpc-shutdown
Previously, if an error handler called jsonrpc-shutdown, and if that
error handler was being called from the process sentinel,
jsonrpc-shutdown would infloop waiting for jsonrpc-sentinel-done to be
set.
Rename the process property jsonrpc-sentinel-done to
jsonrpc-sentinel-cleanup-started, arrange for it to be set earlier
in the sentinel, and also check for it earlier in jsonrpc-shutdown.
* lisp/jsonrpc.el (Version): Bump to 1.0.7.
(jsonrpc--process-sentinel): Set jsonrpc-sentinel-cleanup-started
a bit earlier than previous jsonrpc-sentinel-done.
(jsonrpc-shutdown): Query jsonrpc-sentinel-cleanup-started
---
lisp/jsonrpc.el | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 020d7f5..af69aa4 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -6,7 +6,7 @@
;; Maintainer: João Távora <address@hidden>
;; Keywords: processes, languages, extensions
;; Package-Requires: ((emacs "25.2"))
-;; Version: 1.0.6
+;; Version: 1.0.7
;; This is an Elpa :core package. Don't use functionality that is not
;; compatible with Emacs 25.2.
@@ -421,13 +421,13 @@ connection object, called when the process dies .")
With optional CLEANUP, kill any associated buffers. "
(unwind-protect
(cl-loop
- with proc = (jsonrpc--process conn)
+ with proc = (jsonrpc--process conn) for i from 0
+ while (not (process-get proc 'jsonrpc-sentinel-cleanup-started))
+ unless (zerop i) do
+ (jsonrpc--warn "Sentinel for %s still hasn't run, deleting it!" proc)
do
(delete-process proc)
- (accept-process-output nil 0.1)
- while (not (process-get proc 'jsonrpc-sentinel-done))
- do (jsonrpc--warn
- "Sentinel for %s still hasn't run, deleting it!" proc))
+ (accept-process-output nil 0.1))
(when cleanup
(kill-buffer (process-buffer (jsonrpc--process conn)))
(kill-buffer (jsonrpc-stderr-buffer conn)))))
@@ -486,6 +486,7 @@ With optional CLEANUP, kill any associated buffers. "
(pcase-let ((`(,_success ,_error ,timeout) triplet))
(when timeout (cancel-timer timeout))))
(jsonrpc--request-continuations connection))
+ (process-put proc 'jsonrpc-sentinel-cleanup-started t)
(unwind-protect
;; Call all outstanding error handlers
(maphash (lambda (_id triplet)
@@ -493,7 +494,6 @@ With optional CLEANUP, kill any associated buffers. "
(funcall error '(:code -1 :message "Server died"))))
(jsonrpc--request-continuations connection))
(jsonrpc--message "Server exited with status %s" (process-exit-status
proc))
- (process-put proc 'jsonrpc-sentinel-done t)
(delete-process proc)
(funcall (jsonrpc--on-shutdown connection) connection)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 2f65525: Jsonrpc error handlers can now safely call jsonrpc-shutdown,
João Távora <=