cannot thread-join the current thread

This commit is contained in:
Tom Tromey 2012-08-27 10:12:29 -06:00
parent 599d4a9940
commit 587dd92ea0
2 changed files with 7 additions and 0 deletions

View file

@ -852,6 +852,9 @@ It is an error for a thread to try to join itself. */)
CHECK_THREAD (thread);
tstate = XTHREAD (thread);
if (tstate == current_thread)
error ("cannot join current thread");
if (tstate->m_specpdl != NULL)
flush_stack_call_func (thread_join_callback, tstate);

View file

@ -70,6 +70,10 @@
(and threads-test-global
(not (thread-alive-p thread)))))))
(ert-deftest threads-join-self ()
"cannot thread-join the current thread"
(should-error (thread-join (current-thread))))
(defvar threads-test-binding nil)
(defun threads-test-thread2 ()