[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.1-82-gb34608
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.1-82-gb346088 |
Date: |
Mon, 23 May 2011 20:25:35 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=b34608813de5fce7f8caee63bdbaeab445eb366e
The branch, stable-2.0 has been updated
via b34608813de5fce7f8caee63bdbaeab445eb366e (commit)
from 2a3db25e283a6b8e30d9761546605e7cae757c67 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b34608813de5fce7f8caee63bdbaeab445eb366e
Author: Andy Wingo <address@hidden>
Date: Mon May 23 22:24:27 2011 +0200
really threadsafe access to symbol table
* libguile/symbols.c (symbols_lock): Rename from intern_lock.
(lookup_interned_symbol, lookup_interned_latin1_symbol): Instead of
faith-based programming, just use the mutex. Though I haven't seen
this break, Ken is right!
-----------------------------------------------------------------------
Summary of changes:
libguile/symbols.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/libguile/symbols.c b/libguile/symbols.c
index 2a1b46d..59aca00 100644
--- a/libguile/symbols.c
+++ b/libguile/symbols.c
@@ -52,6 +52,7 @@
static SCM symbols;
+static scm_i_pthread_mutex_t symbols_lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
#ifdef GUILE_DEBUG
SCM_DEFINE (scm_sys_symbols, "%symbols", 0, 0, 0,
@@ -108,13 +109,11 @@ lookup_interned_symbol (SCM name, unsigned long raw_hash)
data.string = name;
data.string_hash = raw_hash;
- /* Strictly speaking, we should take a lock here. But instead we rely
- on the fact that if this fails, we do take the lock on the
- intern_symbol path; and since nothing deletes from the hash table
- except GC, we should be OK. */
+ scm_i_pthread_mutex_lock (&symbols_lock);
handle = scm_hash_fn_get_handle_by_hash (symbols, raw_hash,
string_lookup_predicate_fn,
&data);
+ scm_i_pthread_mutex_unlock (&symbols_lock);
if (scm_is_true (handle))
return SCM_CAR (handle);
@@ -151,13 +150,11 @@ lookup_interned_latin1_symbol (const char *str, size_t
len,
data.len = len;
data.string_hash = raw_hash;
- /* Strictly speaking, we should take a lock here. But instead we rely
- on the fact that if this fails, we do take the lock on the
- intern_symbol path; and since nothing deletes from the hash table
- except GC, we should be OK. */
+ scm_i_pthread_mutex_lock (&symbols_lock);
handle = scm_hash_fn_get_handle_by_hash (symbols, raw_hash,
latin1_lookup_predicate_fn,
&data);
+ scm_i_pthread_mutex_unlock (&symbols_lock);
if (scm_is_true (handle))
return SCM_CAR (handle);
@@ -187,8 +184,6 @@ symbol_lookup_assoc_fn (SCM obj, SCM alist, void *closure)
return SCM_BOOL_F;
}
-static scm_i_pthread_mutex_t intern_lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
-
/* Intern SYMBOL, an uninterned symbol. Might return a different
symbol, if another one was interned at the same time. */
static SCM
@@ -196,12 +191,12 @@ intern_symbol (SCM symbol)
{
SCM handle;
- scm_i_pthread_mutex_lock (&intern_lock);
+ scm_i_pthread_mutex_lock (&symbols_lock);
handle = scm_hash_fn_create_handle_x (symbols, symbol, SCM_UNDEFINED,
symbol_lookup_hash_fn,
symbol_lookup_assoc_fn,
NULL);
- scm_i_pthread_mutex_unlock (&intern_lock);
+ scm_i_pthread_mutex_unlock (&symbols_lock);
return SCM_CAR (handle);
}
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.1-82-gb346088,
Andy Wingo <=