From: Giuseppe Scrivano Date: Fri, 18 Sep 2009 10:43:01 +0000 (+0200) Subject: A new thread maintain the parent's buffer when the thread starts not after it entered... X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c9b7c4d019b8ccb9def40fc5f6defa0ec1a00b69;p=emacs.git A new thread maintain the parent's buffer when the thread starts not after it entered in `global_lock'. --- diff --git a/src/thread.c b/src/thread.c index 4143da714b0..94fb7e42483 100644 --- a/src/thread.c +++ b/src/thread.c @@ -182,8 +182,6 @@ run_thread (void *state) /* Thread-local assignment. */ current_thread = self; - pthread_mutex_lock (&global_lock); - /* We need special handling to set the initial buffer. Our parent thread is very likely to be using this same buffer so we will typically wait for the parent thread to release it first. */ @@ -192,6 +190,8 @@ run_thread (void *state) self->m_current_buffer = 0; set_buffer_internal (XBUFFER (buffer)); + pthread_mutex_lock (&global_lock); + /* It might be nice to do something with errors here. */ internal_condition_case (invoke_thread_function, Qt, do_nothing);