mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-03 19:26:34 +02:00
Issue #450 - Updated the runtime to avoid a race condition when creating new symbols
This commit is contained in:
parent
6ef8773b31
commit
2880301d69
3 changed files with 10 additions and 8 deletions
|
@ -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`.
|
||||
|
||||
|
|
11
runtime.c
11
runtime.c
|
@ -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);
|
||||
return psym;
|
||||
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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue