aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
Diffstat (limited to 'test/src')
-rw-r--r--test/src/thread-tests.el23
1 files changed, 17 insertions, 6 deletions
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el
index a447fb3914e..364f6d61f05 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -100,15 +100,24 @@
100 (progn 100 (progn
101 (setq threads-test-global nil) 101 (setq threads-test-global nil)
102 (let ((thread (make-thread #'threads-test-thread1))) 102 (let ((thread (make-thread #'threads-test-thread1)))
103 (thread-join thread) 103 (and (= (thread-join thread) 23)
104 (and threads-test-global 104 (= threads-test-global 23)
105 (not (thread-alive-p thread))))))) 105 (not (thread-alive-p thread)))))))
106 106
107(ert-deftest threads-join-self () 107(ert-deftest threads-join-self ()
108 "Cannot `thread-join' the current thread." 108 "Cannot `thread-join' the current thread."
109 (skip-unless (featurep 'threads)) 109 (skip-unless (featurep 'threads))
110 (should-error (thread-join (current-thread)))) 110 (should-error (thread-join (current-thread))))
111 111
112(ert-deftest threads-join-error ()
113 "Test of error signalling from `thread-join'."
114 :tags '(:unstable)
115 (skip-unless (featurep 'threads))
116 (let ((thread (make-thread #'threads-call-error)))
117 (while (thread-alive-p thread)
118 (thread-yield))
119 (should-error (thread-join thread))))
120
112(defvar threads-test-binding nil) 121(defvar threads-test-binding nil)
113 122
114(defun threads-test-thread2 () 123(defun threads-test-thread2 ()
@@ -197,7 +206,7 @@
197(ert-deftest threads-mutex-signal () 206(ert-deftest threads-mutex-signal ()
198 "Test signaling a blocked thread." 207 "Test signaling a blocked thread."
199 (skip-unless (featurep 'threads)) 208 (skip-unless (featurep 'threads))
200 (should 209 (should-error
201 (progn 210 (progn
202 (setq threads-mutex (make-mutex)) 211 (setq threads-mutex (make-mutex))
203 (setq threads-mutex-key nil) 212 (setq threads-mutex-key nil)
@@ -206,8 +215,10 @@
206 (while (not threads-mutex-key) 215 (while (not threads-mutex-key)
207 (thread-yield)) 216 (thread-yield))
208 (thread-signal thr 'quit nil) 217 (thread-signal thr 'quit nil)
209 (thread-join thr)) 218 ;; `quit' is not catched by `should-error'. We must indicate it.
210 t))) 219 (condition-case nil
220 (thread-join thr)
221 (quit (signal 'error nil)))))))
211 222
212(defun threads-test-io-switch () 223(defun threads-test-io-switch ()
213 (setq threads-test-global 23)) 224 (setq threads-test-global 23))