diff options
author | Marius Vollmer <mvo@zagadka.de> | 2005-01-24 19:14:54 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2005-01-24 19:14:54 +0000 |
commit | a54a94b39707f47a1f30533bcf7664094d65d073 (patch) | |
tree | 69a524a4c3fbb084e1e2fef05da61e1852700909 /libguile/gc-malloc.c | |
parent | be1b896c82273d97b79cd839d7281b46e54920f8 (diff) | |
download | guile-a54a94b39707f47a1f30533bcf7664094d65d073.tar.gz |
Threading changes.
Diffstat (limited to 'libguile/gc-malloc.c')
-rw-r--r-- | libguile/gc-malloc.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c index b909e9424..faa37fb13 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_rec_mutex_lock (&scm_i_sweep_mutex); + scm_pthread_mutex_lock (&scm_i_sweep_mutex); scm_i_sweep_all_segments ("realloc"); SCM_SYSCALL (ptr = realloc (mem, size)); if (ptr) { - scm_rec_mutex_unlock (&scm_i_sweep_mutex); + pthread_mutex_unlock (&scm_i_sweep_mutex); return ptr; } scm_igc ("realloc"); scm_i_sweep_all_segments ("realloc"); - scm_rec_mutex_unlock (&scm_i_sweep_mutex); + pthread_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) { - scm_i_plugin_mutex_lock (&scm_i_gc_admin_mutex); + pthread_mutex_lock (&scm_i_gc_admin_mutex); scm_mallocated -= size; scm_gc_malloc_collected += size; - scm_i_plugin_mutex_unlock (&scm_i_gc_admin_mutex); + pthread_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; - scm_i_plugin_mutex_lock (&scm_i_gc_admin_mutex); + pthread_mutex_lock (&scm_i_gc_admin_mutex); if (ULONG_MAX - size < scm_mallocated) overflow = 1; else @@ -202,12 +202,10 @@ increase_mtrigger (size_t size, const char *what) if (scm_mallocated > scm_mtrigger) triggered = 1; } - scm_i_plugin_mutex_unlock (&scm_i_gc_admin_mutex); + pthread_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, @@ -220,7 +218,7 @@ increase_mtrigger (size_t size, const char *what) unsigned long prev_alloced; float yield; - scm_rec_mutex_lock (&scm_i_sweep_mutex); + scm_pthread_mutex_lock (&scm_i_sweep_mutex); prev_alloced = mallocated; scm_igc (what); @@ -265,7 +263,7 @@ increase_mtrigger (size_t size, const char *what) #endif } - scm_rec_mutex_unlock (&scm_i_sweep_mutex); + pthread_mutex_unlock (&scm_i_sweep_mutex); } } |