]> git.eshelyaron.com Git - emacs.git/commitdiff
Release the current buffer when a thread exits.
authorTom Tromey <tromey@redhat.com>
Mon, 14 Sep 2009 22:30:43 +0000 (00:30 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Mon, 14 Sep 2009 22:30:43 +0000 (00:30 +0200)
src/buffer.c
src/buffer.h
src/thread.c

index 10378c3edf4a986583b9daae72354e11a0a17607..b20d0c42b6a387ce247daf6999ca4bf836cdbc53 100644 (file)
@@ -1883,6 +1883,21 @@ acquire_buffer (char *end, void *nb)
     }
 }
 
+/* Mark the thread's current buffer as not having an owner.  This is
+   only ok to call when the thread is shutting down.  The global lock
+   must be held when calling this function.  */
+
+void
+release_buffer (thread)
+     struct thread_state *thread;
+{
+  if (!EQ (thread->m_current_buffer->owner, Qt))
+    {
+      thread->m_current_buffer->owner = Qnil;
+      pthread_cond_broadcast (&buffer_cond);
+    }
+}
+
 /* Set the current buffer to B, and do not set windows_or_buffers_changed.
    This is used by redisplay.  */
 
index 85c78893d4e55e513cd02ba48e6a2bba5c79c4ce..168cf1a65e8b26e42af4f6765e5e4f667397b3a8 100644 (file)
@@ -854,6 +854,7 @@ extern void record_buffer P_ ((Lisp_Object));
 extern void buffer_slot_type_mismatch P_ ((Lisp_Object, int)) NO_RETURN;
 extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT));
 extern void mmap_set_vars P_ ((int));
+extern void release_buffer P_ ((struct thread_state *));
 
 /* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements.
    If NEXTP is non-NULL, return next overlay there.
index 709e50e029a457c807a39c86d61d7d65b10ce749..3b6134aaeb4afc5849cfdc3470152cf742349605 100644 (file)
@@ -181,6 +181,8 @@ run_thread (void *state)
     ;
   *iter = (*iter)->next_thread;
 
+  release_buffer (self);
+
   xfree (self->m_specpdl);
   xfree (self);