/[emacs]/emacs/src/alloc.c
ViewVC logotype

Diff of /emacs/src/alloc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.354 by jhd, Tue Dec 7 08:25:43 2004 UTC revision 1.355 by jhd, Tue Dec 7 17:38:30 2004 UTC
# Line 91  extern __malloc_size_t __malloc_extra_bl Line 91  extern __malloc_size_t __malloc_extra_bl
91    
92  #if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD)  #if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD)
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    
111  static pthread_mutex_t alloc_mutex;  static pthread_mutex_t alloc_mutex;
112  pthread_t main_thread;  pthread_t main_thread;
113    

Legend:
Removed from v.1.354  
changed lines
  Added in v.1.355

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26