From c2fe5919c873a05e8f781ff4e9d68ff400c9a8b3 Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Tue, 9 Sep 2008 15:56:46 +0000 Subject: [PATCH] Fix for multithreaded access to the symbol table svn: r11613 --- src/mzscheme/src/symbol.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mzscheme/src/symbol.c b/src/mzscheme/src/symbol.c index 6b81bbf160..846c00363b 100644 --- a/src/mzscheme/src/symbol.c +++ b/src/mzscheme/src/symbol.c @@ -375,10 +375,14 @@ scheme_intern_exact_symbol_in_table(Scheme_Hash_Table *symbol_table, int kind, c mzrt_rwlock_unlock(symbol_table_lock); if (!sym) { - sym = make_a_symbol(name, len, kind); - + Scheme_Object *newsymbol; + newsymbol = make_a_symbol(name, len, kind); + + /* we must return the result of this symbol bucket call because another + * thread could have inserted the same symbol between the first + * :qsymbol_bucket call above and this one */ mzrt_rwlock_wrlock(symbol_table_lock); - symbol_bucket(symbol_table, name, len, sym); + sym = symbol_bucket(symbol_table, name, len, newsymbol); mzrt_rwlock_unlock(symbol_table_lock); }