aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2004-12-07 17:38:30 +0000
committerJan Djärv2004-12-07 17:38:30 +0000
commitf415cacdbd53833dff84f8666dcbcb7035fb9320 (patch)
treebc34964328d4d36ff9df12b18c1170131e8df83b /src
parent948a35c14408f38555a6b84e4b7a000d9578b8ca (diff)
downloademacs-f415cacdbd53833dff84f8666dcbcb7035fb9320.tar.gz
emacs-f415cacdbd53833dff84f8666dcbcb7035fb9320.zip
* alloc.c: Add comment about the reason for (UN)BLOCK_INPUT_ALLOC.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/alloc.c17
2 files changed, 21 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 999dbf373d5..6b3a832e840 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
12004-12-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * alloc.c: Add comment about the reason for (UN)BLOCK_INPUT_ALLOC.
4
12004-12-07 Stefan <monnier@iro.umontreal.ca> 52004-12-07 Stefan <monnier@iro.umontreal.ca>
2 6
3 * eval.c (init_eval_once): Increase max_specpdl_size to 1000. 7 * eval.c (init_eval_once): Increase max_specpdl_size to 1000.
diff --git a/src/alloc.c b/src/alloc.c
index 4f3a0d6f2c4..0ea389117ba 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -91,6 +91,23 @@ extern __malloc_size_t __malloc_extra_blocks;
91 91
92#if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) 92#if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD)
93 93
94/* When GTK uses the file chooser dialog, different backends can be loaded
95 dynamically. One such a backend is the Gnome VFS backend that gets loaded
96 if you run Gnome. That backend creates several threads and also allocates
97 memory with malloc.
98
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
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
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).
105
106 When UNBLOCK_INPUT is called, revoke_input_signal may be called. If this
107 happens in one of the backend threads we will have two threads that tries
108 to run Emacs code at once, and the code is not prepared for that.
109 To prevent that, we only call BLOCK/UNBLOCK from the main thread. */
110
94static pthread_mutex_t alloc_mutex; 111static pthread_mutex_t alloc_mutex;
95pthread_t main_thread; 112pthread_t main_thread;
96 113