From da62cfd20340166df88bb9fdcdd0720bdc72c7ae Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Sun, 12 Jul 2020 17:26:02 +0200 Subject: [PATCH] multithreading: fix segfaults in ecl_import_current_thread We also need the interrupt_struct in the fake env to allow explicitely checking for interrupts on platforms where this doesn't happen implicitely by using mprotect. --- src/c/threads/process.d | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/c/threads/process.d b/src/c/threads/process.d index be785bbec..952717b93 100755 --- a/src/c/threads/process.d +++ b/src/c/threads/process.d @@ -394,6 +394,10 @@ ecl_import_current_thread(cl_object name, cl_object bindings) * we can safely store pointers to memory allocated by the gc there. */ memset(env_aux, 0, sizeof(*env_aux)); env_aux->disable_interrupts = 1; + env_aux->interrupt_struct = ecl_alloc_unprotected(sizeof(*env_aux->interrupt_struct)); + env_aux->interrupt_struct->pending_interrupt = ECL_NIL; + env_aux->interrupt_struct->signal_queue_spinlock = ECL_NIL; + env_aux->interrupt_struct->signal_queue = ECL_NIL; ecl_set_process_env(env_aux); ecl_init_env(env_aux);