mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-23 13:01:42 -08:00
threading: fix race conditions in CLOS cache
Writes in the cache were not protected against interrupts, leading
to segfaults when clear_list_from_cache or ecl_search_cache were
interrupted.
This commit is contained in:
parent
3c7085798d
commit
e7838e4b86
1 changed files with 4 additions and 0 deletions
|
|
@ -56,6 +56,7 @@ clear_one_from_cache(ecl_cache_ptr cache, cl_object target)
|
|||
static void
|
||||
clear_list_from_cache(ecl_cache_ptr cache)
|
||||
{
|
||||
ecl_disable_interrupts();
|
||||
cl_object list = ecl_atomic_get(&cache->clear_list);
|
||||
cl_object table = cache->table;
|
||||
cl_index i, total_size = table->vector.dim;
|
||||
|
|
@ -68,6 +69,7 @@ clear_list_from_cache(ecl_cache_ptr cache)
|
|||
}
|
||||
}
|
||||
}
|
||||
ecl_enable_interrupts();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -137,6 +139,7 @@ ecl_search_cache(ecl_cache_ptr cache)
|
|||
}
|
||||
#endif
|
||||
{
|
||||
ecl_disable_interrupts();
|
||||
cl_object table = cache->table;
|
||||
cl_object keys = cache->keys;
|
||||
cl_index argno = keys->vector.fillp;
|
||||
|
|
@ -213,6 +216,7 @@ ecl_search_cache(ecl_cache_ptr cache)
|
|||
RECORD_GEN_SET(e, g);
|
||||
}
|
||||
}
|
||||
ecl_enable_interrupts();
|
||||
return (ecl_cache_record_ptr)min_e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue