diff options
| author | Karoly Lorentey | 2004-12-08 22:21:07 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-12-08 22:21:07 +0000 |
| commit | b3be62d4c924fd8aa8b6fdfa96b03a015c586285 (patch) | |
| tree | 84d262494fc16e4a13f68dad39f2bbcd566a98d4 /src/alloc.c | |
| parent | fad2f6858075f49c4c8fd16f0535c287e3f14ac3 (diff) | |
| parent | 3073399bdafd5283661fae867983d0d30c7f2536 (diff) | |
| download | emacs-b3be62d4c924fd8aa8b6fdfa96b03a015c586285.tar.gz emacs-b3be62d4c924fd8aa8b6fdfa96b03a015c586285.zip | |
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-715
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-717
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-718
RCS keyword removal
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-719
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-74
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-272
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c index 56f8be25f61..4cf5de46d21 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 | |||
| 94 | static pthread_mutex_t alloc_mutex; | 111 | static pthread_mutex_t alloc_mutex; |
| 95 | pthread_t main_thread; | 112 | pthread_t main_thread; |
| 96 | 113 | ||