summaryrefslogtreecommitdiff
path: root/libguile/gc-malloc.c
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2005-01-24 23:41:14 +0000
committerMarius Vollmer <mvo@zagadka.de>2005-01-24 23:41:14 +0000
commit76da80e7881947ebcdb647e5ce4be029fece29f2 (patch)
tree9a56249fecf0002eefc25c6a0bfeb53a2b277d7f /libguile/gc-malloc.c
parenta54a94b39707f47a1f30533bcf7664094d65d073 (diff)
downloadguile-76da80e7881947ebcdb647e5ce4be029fece29f2.tar.gz
Reverted changed from 2005/01/24 19:14:54, which was a commit to the
wrong branch. Sorry.
Diffstat (limited to 'libguile/gc-malloc.c')
-rw-r--r--libguile/gc-malloc.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c
index faa37fb13..b909e9424 100644
--- a/libguile/gc-malloc.c
+++ b/libguile/gc-malloc.c
@@ -110,21 +110,21 @@ scm_realloc (void *mem, size_t size)
if (ptr)
return ptr;
- scm_pthread_mutex_lock (&scm_i_sweep_mutex);
+ scm_rec_mutex_lock (&scm_i_sweep_mutex);
scm_i_sweep_all_segments ("realloc");
SCM_SYSCALL (ptr = realloc (mem, size));
if (ptr)
{
- pthread_mutex_unlock (&scm_i_sweep_mutex);
+ scm_rec_mutex_unlock (&scm_i_sweep_mutex);
return ptr;
}
scm_igc ("realloc");
scm_i_sweep_all_segments ("realloc");
- pthread_mutex_unlock (&scm_i_sweep_mutex);
+ scm_rec_mutex_unlock (&scm_i_sweep_mutex);
SCM_SYSCALL (ptr = realloc (mem, size));
if (ptr)
@@ -180,10 +180,10 @@ scm_strdup (const char *str)
static void
decrease_mtrigger (size_t size, const char * what)
{
- pthread_mutex_lock (&scm_i_gc_admin_mutex);
+ scm_i_plugin_mutex_lock (&scm_i_gc_admin_mutex);
scm_mallocated -= size;
scm_gc_malloc_collected += size;
- pthread_mutex_unlock (&scm_i_gc_admin_mutex);
+ scm_i_plugin_mutex_unlock (&scm_i_gc_admin_mutex);
}
static void
@@ -192,7 +192,7 @@ increase_mtrigger (size_t size, const char *what)
size_t mallocated = 0;
int overflow = 0, triggered = 0;
- pthread_mutex_lock (&scm_i_gc_admin_mutex);
+ scm_i_plugin_mutex_lock (&scm_i_gc_admin_mutex);
if (ULONG_MAX - size < scm_mallocated)
overflow = 1;
else
@@ -202,10 +202,12 @@ increase_mtrigger (size_t size, const char *what)
if (scm_mallocated > scm_mtrigger)
triggered = 1;
}
- pthread_mutex_unlock (&scm_i_gc_admin_mutex);
+ scm_i_plugin_mutex_unlock (&scm_i_gc_admin_mutex);
if (overflow)
- scm_memory_error ("Overflow of scm_mallocated: too much memory in use.");
+ {
+ scm_memory_error ("Overflow of scm_mallocated: too much memory in use.");
+ }
/*
A program that uses a lot of malloced collectable memory (vectors,
@@ -218,7 +220,7 @@ increase_mtrigger (size_t size, const char *what)
unsigned long prev_alloced;
float yield;
- scm_pthread_mutex_lock (&scm_i_sweep_mutex);
+ scm_rec_mutex_lock (&scm_i_sweep_mutex);
prev_alloced = mallocated;
scm_igc (what);
@@ -263,7 +265,7 @@ increase_mtrigger (size_t size, const char *what)
#endif
}
- pthread_mutex_unlock (&scm_i_sweep_mutex);
+ scm_rec_mutex_unlock (&scm_i_sweep_mutex);
}
}