aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/alloc.c b/src/alloc.c
index a1ba6dfc51..3723f9ea87 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -103,7 +103,7 @@ extern __malloc_size_t __malloc_extra_blocks;
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
+ 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,17 +1113,34 @@ allocate_buffer ()
}
+#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
- pairs; unfortunately, we have no idea what C library functions
+ 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 SYSTEM_MALLOC
+#ifndef SYNC_INPUT
+
#ifndef DOUG_LEA_MALLOC
extern void * (*__malloc_hook) P_ ((size_t));
extern void * (*__realloc_hook) P_ ((void *, size_t));
@@ -1182,20 +1199,6 @@ emacs_blocked_free (ptr)
}
-/* 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 *
@@ -1347,6 +1350,7 @@ uninterrupt_malloc ()
__realloc_hook = emacs_blocked_realloc;
}
+#endif /* not SYNC_INPUT */
#endif /* not SYSTEM_MALLOC */