aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorEli Zaretskii2016-12-11 17:59:55 +0200
committerEli Zaretskii2016-12-11 17:59:55 +0200
commit997081634a3b6c2359226305db05c818c492a9b2 (patch)
treecc86cad29bc4a3621c0a48a6a196d87f7b5d13eb /test/src
parentc0cfe9bc143686cd97d431831f47787753a95a42 (diff)
downloademacs-997081634a3b6c2359226305db05c818c492a9b2.tar.gz
emacs-997081634a3b6c2359226305db05c818c492a9b2.zip
Avoid aborts when a thread signals an error
* src/thread.h (struct thread_state): Add members m_waiting_for_input and m_input_available_clear_time. (waiting_for_input, input_available_clear_time): New macros. * src/keyboard.c (waiting_for_input, input_available_clear_time): Remove; they are now macros that reference the current thread. (Bug#25171) * src/w32select.c: Don't include keyboard.h. * test/src/thread-tests.el (thread-errors): New test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/thread-tests.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el
index 4631882186c..4e7b052cba0 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -209,5 +209,20 @@
209 (string= "hi bob" 209 (string= "hi bob"
210 (condition-name (make-condition-variable (make-mutex) 210 (condition-name (make-condition-variable (make-mutex)
211 "hi bob"))))) 211 "hi bob")))))
212(defun call-error ()
213 "Call `error'."
214 (error "Error is called"))
215
216;; This signals an error internally; the error should be caught.
217(defun thread-custom ()
218 (defcustom thread-custom-face 'highlight
219 "Face used for thread customizations."
220 :type 'face
221 :group 'widget-faces))
222
223(ert-deftest thread-errors ()
224 "Test what happens when a thread signals an error."
225 (should (threadp (make-thread #'call-error "call-error")))
226 (should (threadp (make-thread #'thread-custom "thread-custom"))))
212 227
213;;; threads.el ends here 228;;; threads.el ends here