mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-22 20:42:03 -08:00
threading: fix interrupt safety of out_of_memory function
This function used writes in the thread local environment while
interrupts where disabled with the env->disable_interrupts
mechanism, which causes problems with the mprotect() mechanism for
fast interrupt dispatch.
This commit is contained in:
parent
57f6637902
commit
b5194ca774
1 changed files with 7 additions and 5 deletions
|
|
@ -103,8 +103,11 @@ out_of_memory(size_t requested_bytes)
|
|||
int interrupts = the_env->disable_interrupts;
|
||||
int method = 0;
|
||||
void *output;
|
||||
if (!interrupts)
|
||||
ecl_disable_interrupts_env(the_env);
|
||||
/* Disable interrupts only with the ext::*interrupts-enabled*
|
||||
* mechanism to allow for writes in the thread local environment */
|
||||
if (interrupts)
|
||||
ecl_enable_interrupts_env(the_env);
|
||||
ecl_bds_bind(the_env, @'ext::*interrupts-enabled*', ECL_NIL);
|
||||
/* Free the input / output buffers */
|
||||
the_env->string_pool = ECL_NIL;
|
||||
|
||||
|
|
@ -151,11 +154,10 @@ out_of_memory(size_t requested_bytes)
|
|||
#ifdef ECL_THREADS
|
||||
ECL_UNWIND_PROTECT_EXIT {
|
||||
mp_giveup_lock(cl_core.error_lock);
|
||||
ecl_enable_interrupts_env(the_env);
|
||||
} ECL_UNWIND_PROTECT_END;
|
||||
#else
|
||||
ecl_enable_interrupts_env(the_env);
|
||||
#endif
|
||||
ecl_bds_unwind1(the_env);
|
||||
ecl_check_pending_interrupts(the_env);
|
||||
switch (method) {
|
||||
case 0: cl_error(1, @'ext::storage-exhausted');
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue