aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 0ea389117ba..5038fdfce10 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -99,7 +99,7 @@ extern __malloc_size_t __malloc_extra_blocks;
99 If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_* 99 If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_*
100 functions below are called from malloc, there is a chance that one 100 functions below are called from malloc, there is a chance that one
101 of these threads preempts the Emacs main thread and the hook variables 101 of these threads preempts the Emacs main thread and the hook variables
102 end up in a inconsistent state. So we have a mutex to prevent that (note 102 end up in an inconsistent state. So we have a mutex to prevent that (note
103 that the backend handles concurrent access to malloc within its own threads 103 that the backend handles concurrent access to malloc within its own threads
104 but Emacs code running in the main thread is not included in that control). 104 but Emacs code running in the main thread is not included in that control).
105 105
@@ -109,7 +109,6 @@ extern __malloc_size_t __malloc_extra_blocks;
109 To prevent that, we only call BLOCK/UNBLOCK from the main thread. */ 109 To prevent that, we only call BLOCK/UNBLOCK from the main thread. */
110 110
111static pthread_mutex_t alloc_mutex; 111static pthread_mutex_t alloc_mutex;
112pthread_t main_thread;
113 112
114#define BLOCK_INPUT_ALLOC \ 113#define BLOCK_INPUT_ALLOC \
115 do \ 114 do \
@@ -1310,8 +1309,6 @@ uninterrupt_malloc ()
1310 pthread_mutexattr_init (&attr); 1309 pthread_mutexattr_init (&attr);
1311 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); 1310 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
1312 pthread_mutex_init (&alloc_mutex, &attr); 1311 pthread_mutex_init (&alloc_mutex, &attr);
1313
1314 main_thread = pthread_self ();
1315#endif /* HAVE_GTK_AND_PTHREAD */ 1312#endif /* HAVE_GTK_AND_PTHREAD */
1316 1313
1317 if (__free_hook != emacs_blocked_free) 1314 if (__free_hook != emacs_blocked_free)