emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/alloc.c


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/src/alloc.c
Date: Tue, 04 Jan 2005 15:35:10 -0500

Index: emacs/src/alloc.c
diff -c emacs/src/alloc.c:1.360 emacs/src/alloc.c:1.361
*** emacs/src/alloc.c:1.360     Sun Jan  2 22:52:23 2005
--- emacs/src/alloc.c   Tue Jan  4 20:22:41 2005
***************
*** 103,109 ****
     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.  */
--- 103,109 ----
     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, reinvoke_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.  */
***************
*** 1113,1129 ****
  }
  
  
  /* Arranging to disable input signals while we're in malloc.
  
     This only works with GNU malloc.  To help out systems which can't
     use GNU malloc, all the calls to malloc, realloc, and free
     elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT
!    pairs; unfortunately, we have no idea what C library functions
     might call malloc, so we can't really protect them unless you're
     using GNU malloc.  Fortunately, most of the major operating systems
     can use GNU malloc.  */
  
! #ifndef SYSTEM_MALLOC
  #ifndef DOUG_LEA_MALLOC
  extern void * (*__malloc_hook) P_ ((size_t));
  extern void * (*__realloc_hook) P_ ((void *, size_t));
--- 1113,1146 ----
  }
  
  
+ #ifndef SYSTEM_MALLOC
+ 
+ /* If we released our reserve (due to running out of memory),
+    and we have a fair amount free once again,
+    try to set aside another reserve in case we run out once more.
+ 
+    This is called when a relocatable block is freed in ralloc.c.  */
+ 
+ void
+ refill_memory_reserve ()
+ {
+   if (spare_memory == 0)
+     spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
+ }
+ 
+ 
  /* Arranging to disable input signals while we're in malloc.
  
     This only works with GNU malloc.  To help out systems which can't
     use GNU malloc, all the calls to malloc, realloc, and free
     elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT
!    pair; unfortunately, we have no idea what C library functions
     might call malloc, so we can't really protect them unless you're
     using GNU malloc.  Fortunately, most of the major operating systems
     can use GNU malloc.  */
  
! #ifndef SYNC_INPUT
! 
  #ifndef DOUG_LEA_MALLOC
  extern void * (*__malloc_hook) P_ ((size_t));
  extern void * (*__realloc_hook) P_ ((void *, size_t));
***************
*** 1182,1201 ****
  }
  
  
- /* If we released our reserve (due to running out of memory),
-    and we have a fair amount free once again,
-    try to set aside another reserve in case we run out once more.
- 
-    This is called when a relocatable block is freed in ralloc.c.  */
- 
- void
- refill_memory_reserve ()
- {
-   if (spare_memory == 0)
-     spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
- }
- 
- 
  /* This function is the malloc hook that Emacs uses.  */
  
  static void *
--- 1199,1204 ----
***************
*** 1347,1352 ****
--- 1350,1356 ----
    __realloc_hook = emacs_blocked_realloc;
  }
  
+ #endif /* not SYNC_INPUT */
  #endif /* not SYSTEM_MALLOC */
  
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]