Commit 73567432 authored by Eli Zaretskii's avatar Eli Zaretskii

Avoid assertion violation when comparing with main-thread

* src/thread.c (unmark_main_thread): New function.
* src/lisp.h (unmark_main_thread): Prototype it.
* src/alloc.c (garbage_collect_1): Call it after sweeping.
(Bug#33073)

* test/src/thread-tests.el (threads-test-bug33073): New test.
parent 134ba45b
......@@ -5863,6 +5863,8 @@ garbage_collect_1 (void *end)
VECTOR_UNMARK (&buffer_defaults);
VECTOR_UNMARK (&buffer_local_symbols);
unmark_main_thread ();
check_cons_list ();
gc_in_progress = 0;
......
......@@ -4011,6 +4011,7 @@ extern void syms_of_module (void);
/* Defined in thread.c. */
extern void mark_threads (void);
extern void unmark_main_thread (void);
/* Defined in editfns.c. */
extern void insert1 (Lisp_Object);
......
......@@ -656,6 +656,12 @@ mark_threads (void)
flush_stack_call_func (mark_threads_callback, NULL);
}
void
unmark_main_thread (void)
{
main_thread.header.size &= ~ARRAY_MARK_FLAG;
}
static void
......
......@@ -388,4 +388,8 @@
(should (= (length (all-threads)) 1))
(should (equal (thread-last-error) '(error "Die, die, die!")))))
(ert-deftest threads-test-bug33073 ()
(let ((th (make-thread 'ignore)))
(should-not (equal th main-thread))))
;;; threads.el ends here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment