/[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.355 by jhd, Tue Dec 7 17:38:30 2004 UTC revision 1.356 by jhd, Wed Dec 15 21:40:39 2004 UTC
# Line 99  extern __malloc_size_t __malloc_extra_bl Line 99  extern __malloc_size_t __malloc_extra_bl
99     If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_*     If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_*
100     functions below are called from malloc, there is a chance that one     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     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     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     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).     but Emacs code running in the main thread is not included in that control).
105    
# Line 109  extern __malloc_size_t __malloc_extra_bl Line 109  extern __malloc_size_t __malloc_extra_bl
109     To prevent that, we only call BLOCK/UNBLOCK from the main thread.  */     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;
 pthread_t main_thread;  
112    
113  #define BLOCK_INPUT_ALLOC                       \  #define BLOCK_INPUT_ALLOC                       \
114    do                                            \    do                                            \
# Line 1310  uninterrupt_malloc () Line 1309  uninterrupt_malloc ()
1309    pthread_mutexattr_init (&attr);    pthread_mutexattr_init (&attr);
1310    pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);    pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
1311    pthread_mutex_init (&alloc_mutex, &attr);    pthread_mutex_init (&alloc_mutex, &attr);
   
   main_thread = pthread_self ();  
1312  #endif /* HAVE_GTK_AND_PTHREAD */  #endif /* HAVE_GTK_AND_PTHREAD */
1313    
1314    if (__free_hook != emacs_blocked_free)    if (__free_hook != emacs_blocked_free)

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

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