modules: release all resources on ecl_halt

Previously we were lazy and simply marked the runtime as "not booted", but now
we do perform a proper shutdown.
This commit is contained in:
Daniel Kochmański 2025-06-06 13:47:07 +02:00
parent 0aa2707d5f
commit f1ffa821ce

View file

@ -260,20 +260,22 @@ ecl_boot(void)
i = ecl_option_values[ECL_OPT_BOOTED];
if (i) {
if (i < 0) {
/* We have called cl_shutdown and want to use ECL again. */
/* The runtime has been only suspended. Resume it.*/
ecl_set_option(ECL_OPT_BOOTED, 1);
}
return 1;
}
init_modules();
ecl_core.path_max = MAXPATHLEN;
return 0;
}
int
ecl_halt(void)
{
ecl_set_option(ECL_OPT_BOOTED, -1);
int i = ecl_option_values[ECL_OPT_BOOTED];
if (i > 0)
free_modules();
ecl_set_option(ECL_OPT_BOOTED, 0);
return 0;
}