aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c14
-rw-r--r--src/buffer.h1
-rw-r--r--src/thread.c11
3 files changed, 17 insertions, 9 deletions
diff --git a/src/buffer.c b/src/buffer.c
index cea1ddb5ab3..babfba3e65f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2033,9 +2033,6 @@ DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0,
2033void 2033void
2034set_buffer_internal_1 (register struct buffer *b) 2034set_buffer_internal_1 (register struct buffer *b)
2035{ 2035{
2036 register struct buffer *old_buf;
2037 register Lisp_Object tail;
2038
2039#ifdef USE_MMAP_FOR_BUFFERS 2036#ifdef USE_MMAP_FOR_BUFFERS
2040 if (b->text->beg == NULL) 2037 if (b->text->beg == NULL)
2041 enlarge_buffer_text (b, 0); 2038 enlarge_buffer_text (b, 0);
@@ -2044,6 +2041,17 @@ set_buffer_internal_1 (register struct buffer *b)
2044 if (current_buffer == b) 2041 if (current_buffer == b)
2045 return; 2042 return;
2046 2043
2044 set_buffer_internal_2 (b);
2045}
2046
2047/* Like set_buffer_internal_1, but doesn't check whether B is already
2048 the current buffer. Called upon switch of the current thread, see
2049 post_acquire_global_lock. */
2050void set_buffer_internal_2 (register struct buffer *b)
2051{
2052 register struct buffer *old_buf;
2053 register Lisp_Object tail;
2054
2047 BUFFER_CHECK_INDIRECTION (b); 2055 BUFFER_CHECK_INDIRECTION (b);
2048 2056
2049 old_buf = current_buffer; 2057 old_buf = current_buffer;
diff --git a/src/buffer.h b/src/buffer.h
index 21ad5e3bc0f..854b5b5dd32 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1082,6 +1082,7 @@ extern void recenter_overlay_lists (struct buffer *, ptrdiff_t);
1082extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char **); 1082extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char **);
1083extern void validate_region (Lisp_Object *, Lisp_Object *); 1083extern void validate_region (Lisp_Object *, Lisp_Object *);
1084extern void set_buffer_internal_1 (struct buffer *); 1084extern void set_buffer_internal_1 (struct buffer *);
1085extern void set_buffer_internal_2 (struct buffer *);
1085extern void set_buffer_temp (struct buffer *); 1086extern void set_buffer_temp (struct buffer *);
1086extern Lisp_Object buffer_local_value (Lisp_Object, Lisp_Object); 1087extern Lisp_Object buffer_local_value (Lisp_Object, Lisp_Object);
1087extern void record_buffer (Lisp_Object); 1088extern void record_buffer (Lisp_Object);
diff --git a/src/thread.c b/src/thread.c
index 3e61723f0ab..6e9ca2e256b 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -55,7 +55,6 @@ release_global_lock (void)
55static void 55static void
56post_acquire_global_lock (struct thread_state *self) 56post_acquire_global_lock (struct thread_state *self)
57{ 57{
58 Lisp_Object buffer;
59 struct thread_state *prev_thread = current_thread; 58 struct thread_state *prev_thread = current_thread;
60 59
61 /* Do this early on, so that code below could signal errors (e.g., 60 /* Do this early on, so that code below could signal errors (e.g.,
@@ -71,12 +70,12 @@ post_acquire_global_lock (struct thread_state *self)
71 if (prev_thread != NULL) 70 if (prev_thread != NULL)
72 unbind_for_thread_switch (prev_thread); 71 unbind_for_thread_switch (prev_thread);
73 rebind_for_thread_switch (); 72 rebind_for_thread_switch ();
74 }
75 73
76 /* We need special handling to re-set the buffer. */ 74 /* Set the new thread's current buffer. This needs to be done
77 XSETBUFFER (buffer, self->m_current_buffer); 75 even if it is the same buffer as that of the previous thread,
78 self->m_current_buffer = 0; 76 because of thread-local bindings. */
79 set_buffer_internal (XBUFFER (buffer)); 77 set_buffer_internal_2 (current_buffer);
78 }
80 79
81 if (!NILP (current_thread->error_symbol)) 80 if (!NILP (current_thread->error_symbol))
82 { 81 {