summaryrefslogtreecommitdiff
path: root/libguile/gc-malloc.c
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2005-03-10 18:39:53 +0000
committerMarius Vollmer <mvo@zagadka.de>2005-03-10 18:39:53 +0000
commitb17e0ac397fbab715704464f35a91745c55e0a1c (patch)
tree6043dac6c12450e04312fe6e36c8b2f6a94a6209 /libguile/gc-malloc.c
parent94d375b5a77578f636494655afafde29eb7f8972 (diff)
downloadguile-b17e0ac397fbab715704464f35a91745c55e0a1c.tar.gz
* gc.h, gc.c (SCM_FREECELL_P): Removed for good.
(scm_block_gc, scm_gc_heap_lock): Removed. Removed all uses. (scm_gc_running_p): Now a macro that refers to the scm_i_thread field. (scm_i_sweep_mutex): Now a non-recursive mutex. GC can not happen recursively. (scm_igc, scm_i_gc): Renamed former to latter. Changed all uses. Do not lock scm_i_sweep_mutex, which is now non-recursive, or set scm_gc_running_p. Do not run the scm_after_gc_c_hook. (scm_gc): Lock scm_i_sweep_mutex, set scm_gc_running_p and run the scm_after_gc_c_hook here. (scm_gc_for_new_cell): Set scm_gc_running_p here and run the scm_after_gc_c_hook when a full GC has in fact been performed. (scm_i_expensive_validation_check): Call scm_gc, not scm_i_gc. * gc-segment.c (scm_i_get_new_heap_segment): Do not check scm_gc_heap_lock. * gc-malloc.c (scm_realloc, increase_mtrigger): Set scm_gc_running_p while the scm_i_sweep_mutex is locked.
Diffstat (limited to 'libguile/gc-malloc.c')
-rw-r--r--libguile/gc-malloc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c
index 127805eb0..a58ed1376 100644
--- a/libguile/gc-malloc.c
+++ b/libguile/gc-malloc.c
@@ -111,19 +111,22 @@ scm_realloc (void *mem, size_t size)
return ptr;
scm_i_scm_pthread_mutex_lock (&scm_i_sweep_mutex);
-
+ scm_gc_running_p = 1;
+
scm_i_sweep_all_segments ("realloc");
SCM_SYSCALL (ptr = realloc (mem, size));
if (ptr)
{
+ scm_gc_running_p = 0;
scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
return ptr;
}
- scm_igc ("realloc");
+ scm_i_gc ("realloc");
scm_i_sweep_all_segments ("realloc");
+ scm_gc_running_p = 0;
scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
SCM_SYSCALL (ptr = realloc (mem, size));
@@ -219,9 +222,10 @@ increase_mtrigger (size_t size, const char *what)
float yield;
scm_i_scm_pthread_mutex_lock (&scm_i_sweep_mutex);
+ scm_gc_running_p = 1;
prev_alloced = mallocated;
- scm_igc (what);
+ scm_i_gc (what);
scm_i_sweep_all_segments ("mtrigger");
yield = (((float) prev_alloced - (float) scm_mallocated)
@@ -262,7 +266,8 @@ increase_mtrigger (size_t size, const char *what)
scm_mtrigger);
#endif
}
-
+
+ scm_gc_running_p = 0;
scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
}
}