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.
This commit is contained in:
Marius Gerbershagen 2020-07-12 17:26:02 +02:00
parent 34b17a9fe0
commit da62cfd203

View file

@ -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);