[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/alloc.c
From: |
Jan Djärv |
Subject: |
[Emacs-diffs] Changes to emacs/src/alloc.c |
Date: |
Tue, 07 Dec 2004 12:48:55 -0500 |
Index: emacs/src/alloc.c
diff -c emacs/src/alloc.c:1.354 emacs/src/alloc.c:1.355
*** emacs/src/alloc.c:1.354 Tue Dec 7 08:25:43 2004
--- emacs/src/alloc.c Tue Dec 7 17:38:30 2004
***************
*** 91,96 ****
--- 91,113 ----
#if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD)
+ /* When GTK uses the file chooser dialog, different backends can be loaded
+ dynamically. One such a backend is the Gnome VFS backend that gets loaded
+ if you run Gnome. That backend creates several threads and also allocates
+ memory with malloc.
+
+ If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_*
+ functions below are called from malloc, there is a chance that one
+ of these threads preempts the Emacs main thread and the hook variables
+ end up in a inconsistent state. So we have a mutex to prevent that (note
+ that the backend handles concurrent access to malloc within its own threads
+ but Emacs code running in the main thread is not included in that control).
+
+ When UNBLOCK_INPUT is called, revoke_input_signal may be called. If this
+ happens in one of the backend threads we will have two threads that tries
+ to run Emacs code at once, and the code is not prepared for that.
+ To prevent that, we only call BLOCK/UNBLOCK from the main thread. */
+
static pthread_mutex_t alloc_mutex;
pthread_t main_thread;
- [Emacs-diffs] Changes to emacs/src/alloc.c, Kim F . Storm, 2004/12/01
- [Emacs-diffs] Changes to emacs/src/alloc.c, Jan Djärv, 2004/12/07
- [Emacs-diffs] Changes to emacs/src/alloc.c,
Jan Djärv <=
- [Emacs-diffs] Changes to emacs/src/alloc.c, Jan Djärv, 2004/12/15
- [Emacs-diffs] Changes to emacs/src/alloc.c, Richard M . Stallman, 2004/12/21
- [Emacs-diffs] Changes to emacs/src/alloc.c, Jan Djärv, 2004/12/25
- [Emacs-diffs] Changes to emacs/src/alloc.c, Jan Djärv, 2004/12/25