summaryrefslogtreecommitdiff
path: root/libguile/foreign.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-10-23 23:38:51 +0200
committerAndy Wingo <wingo@pobox.com>2011-10-24 12:48:36 +0200
commit203a92b67b6a6c64c9e9f33d99c48f4699ed30e2 (patch)
tree0926fb5490c8e8d311cc263bc9cfebd3669f6978 /libguile/foreign.c
parent54a9b981a4e64dd58e1d3dec474b8c397c30c1c9 (diff)
downloadguile-203a92b67b6a6c64c9e9f33d99c48f4699ed30e2.tar.gz
convert internal weak hash table users to use the weak table api
The weak table API isn't public yet. It could be after some review. But we can go ahead and use it now internally. * libguile/foreign.c: * libguile/goops.c: * libguile/objprop.c: * libguile/procprop.c: * libguile/smob.c: * libguile/srcprop.c: Update weak table users to new API. No locking needed!
Diffstat (limited to 'libguile/foreign.c')
-rw-r--r--libguile/foreign.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libguile/foreign.c b/libguile/foreign.c
index e82a8c581..2a11fb087 100644
--- a/libguile/foreign.c
+++ b/libguile/foreign.c
@@ -87,15 +87,12 @@ static SCM cif_to_procedure (SCM cif, SCM func_ptr);
static SCM pointer_weak_refs = SCM_BOOL_F;
-static scm_i_pthread_mutex_t weak_refs_lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
static void
register_weak_reference (SCM from, SCM to)
{
- scm_i_pthread_mutex_lock (&weak_refs_lock);
- scm_hashq_set_x (pointer_weak_refs, from, to);
- scm_i_pthread_mutex_unlock (&weak_refs_lock);
+ scm_weak_table_putq_x (pointer_weak_refs, from, to);
}
static void
@@ -1272,7 +1269,7 @@ scm_register_foreign (void)
"scm_init_foreign",
(scm_t_extension_init_func)scm_init_foreign,
NULL);
- pointer_weak_refs = scm_make_weak_key_hash_table (SCM_UNDEFINED);
+ pointer_weak_refs = scm_c_make_weak_table (0, SCM_WEAK_TABLE_KIND_KEY);
}
/*