emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 5fcc777: Fix last change with thread marking under


From: Eli Zaretskii
Subject: [Emacs-diffs] master 5fcc777: Fix last change with thread marking under GC_CHECK_MARKED_OBJECTS
Date: Thu, 22 Dec 2016 16:14:39 +0000 (UTC)

branch: master
commit 5fcc777ff36c3102ddddd2fb932cb8d0b7cc2741
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix last change with thread marking under GC_CHECK_MARKED_OBJECTS
    
    * src/thread.c (primary_thread_p): New function.
    * src/alloc.c (mark_object): Use 'primary_thread_p' to bypass tests
    meant for thread objects allocated dynamically.
    * src/thread.h (primary_thread_p): Add prototype.
---
 src/alloc.c  |    4 ++--
 src/thread.c |    6 ++++++
 src/thread.h |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index e979f36..93ea286 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6406,7 +6406,7 @@ mark_object (Lisp_Object arg)
 
 #ifdef GC_CHECK_MARKED_OBJECTS
        m = mem_find (po);
-       if (m == MEM_NIL && !SUBRP (obj) && !THREADP (obj))
+       if (m == MEM_NIL && !SUBRP (obj) && !primary_thread_p (po))
          emacs_abort ();
 #endif /* GC_CHECK_MARKED_OBJECTS */
 
@@ -6418,7 +6418,7 @@ mark_object (Lisp_Object arg)
 
        if (pvectype != PVEC_SUBR
            && pvectype != PVEC_BUFFER
-           && pvectype != PVEC_THREAD)
+           && !primary_thread_p (po))
          CHECK_LIVE (live_vector_p);
 
        switch (pvectype)
diff --git a/src/thread.c b/src/thread.c
index bf2cf1b..6966df3 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -950,6 +950,12 @@ init_primary_thread (void)
   primary_thread.event_object = Qnil;
 }
 
+bool
+primary_thread_p (void *ptr)
+{
+  return (ptr == &primary_thread) ? true : false;
+}
+
 void
 init_threads_once (void)
 {
diff --git a/src/thread.h b/src/thread.h
index 7dee67d..0090652 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -236,6 +236,7 @@ extern void maybe_reacquire_global_lock (void);
 extern void init_threads_once (void);
 extern void init_threads (void);
 extern void syms_of_threads (void);
+extern bool primary_thread_p (void *);
 
 typedef int select_func (int, fd_set *, fd_set *, fd_set *,
                         const struct timespec *, const sigset_t *);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]