Issue #450 - Updated the runtime to avoid a race condition when creating new symbols

This commit is contained in:
Justin Ethier 2021-03-04 18:02:48 -05:00
parent 6ef8773b31
commit 2880301d69
3 changed files with 10 additions and 8 deletions

View file

@ -10,6 +10,7 @@ Features
Bug Fixes
- Updated the runtime to avoid a race condition when creating new symbols. Thanks to Skye Soss for the bug report and patch.
- Prevent the compiler from inlining calls to primitives that open ports, avoiding a range of issues such as an open file operation being inlined across multiple places in the intermediate code.
- Arthur Maciel updated `current-jiffy` to use `clock_gettime`.

View file

@ -454,9 +454,16 @@ static object find_symbol_by_name(const char *name)
object add_symbol(symbol_type * psym)
{
pthread_mutex_lock(&symbol_table_lock); // Only 1 "writer" allowed
set_insert(&symbol_table, psym);
bool inserted = set_insert(&symbol_table, psym);
pthread_mutex_unlock(&symbol_table_lock);
if (!inserted) {
object sym = find_symbol_by_name(psym->desc);
free((char *)(psym->desc));
free(psym);
return sym;
} else {
return psym;
}
}
static object add_symbol_by_name(const char *name)

View file

@ -2162,12 +2162,6 @@
*globals*)
(emit "")
;; Initialize symbol table
(for-each
(lambda (sym)
(emit* " add_symbol(quote_" (mangle sym) ");"))
*symbols*)
;; Initialize globals
(let* ((prefix " ")
(emit-global