diff options
author | Neil Jerram <neil@ossau.uklinux.net> | 2009-03-25 22:50:46 +0000 |
---|---|---|
committer | Neil Jerram <neil@ossau.uklinux.net> | 2009-03-25 22:50:46 +0000 |
commit | 7627abf6ecf1770367ea2c5f8d61e14fa4843c8a (patch) | |
tree | 5d0d4f24a9809f49b2001c95773d2d177947d79a /libguile/modules.c | |
parent | 7b6b81cfef3705d20715b978b51004a8c4a6ddf6 (diff) | |
download | guile-7627abf6ecf1770367ea2c5f8d61e14fa4843c8a.tar.gz |
Allow non-weak hash tables to be automatically thread-safe
This patch allows a fat mutex to be associated with a hash table.
When a hash table has an associated mutex, that mutex will be
automatically locked and unlocked around all operations (include
lookups) on the hash table's internal data.
* libguile/hashtab.c (make_hash_table): Init mutex field to #f.
(hashtable_mark): New function.
(scm_hash_fn_get_handle, scm_hash_fn_create_handle_x,
scm_hash_fn_remove_x, scm_hash_clear_x, scm_internal_hash_fold,
scm_internal_hash_for_each_handle): If the hash table has a mutex,
lock and unlock it around all accessing of the hash table's
internals.
(scm_hash_use_mutex_x): New function.
(scm_hashtab_prehistory): Use hashtable_mark as hash table mark
function.
* libguile/hashtab.h (SCM_HASHTABLE_MUTEX, SCM_SET_HASHTABLE_MUTEX,
scm_hash_use_mutex_x): New declarations.
(scm_t_hashtable): New mutex field.
Diffstat (limited to 'libguile/modules.c')
0 files changed, 0 insertions, 0 deletions