summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/alloc.c2
-rw-r--r--src/lisp.h1
-rw-r--r--src/thread.c6
-rw-r--r--test/src/thread-tests.el4
4 files changed, 13 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 3b150797c36..0e48b33882c 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -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;
diff --git a/src/lisp.h b/src/lisp.h
index a7a26ef350e..145901dff5e 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -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);
diff --git a/src/thread.c b/src/thread.c
index fc933440fcc..3674af0e47b 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -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
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el
index 109e71128ab..36bb6377901 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -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