cl_shutdown() and cl_boot() may be called multiple times. cl_shutdown() empties the list of hooks when they are invoked.

This commit is contained in:
jgarcia 2006-06-24 12:41:39 +00:00
parent 252c7f3510
commit b59a1c4c47
2 changed files with 23 additions and 9 deletions

View file

@ -265,6 +265,8 @@ ECL 0.9i
- ecl_listen_stream (used in LISTEN or READ-CHAR-NO-HANG) now returns the
correct value when applied on a CLOS stream (M. Goffioul)
- Calling cl_shutdown() or cl_boot() multiple times is now safe.
* Documentation:
- The HTML manuals now use CSS for a more appealing look.

View file

@ -130,19 +130,23 @@ static const struct {
int
cl_shutdown(void)
{
cl_object l = SYM_VAL(@'si::*exit-hooks*');
cl_object form = cl_list(2, @'funcall', Cnil);
while (CONSP(l)) {
CADR(form) = CAR(l);
si_safe_eval(3, form, Cnil, OBJNULL);
l = CDR(l);
}
if (ecl_booted > 0) {
cl_object l = SYM_VAL(@'si::*exit-hooks*');
cl_object form = cl_list(2, @'funcall', Cnil);
while (CONSP(l)) {
CADR(form) = CAR(l);
si_safe_eval(3, form, Cnil, OBJNULL);
l = CDR(l);
ECL_SET(@'si::*exit-hooks*', l);
}
#ifdef ENABLE_DLOPEN
ecl_library_close_all();
ecl_library_close_all();
#endif
#ifdef TCP
ecl_tcp_close_all();
ecl_tcp_close_all();
#endif
}
ecl_booted = -1;
return 1;
}
@ -153,6 +157,14 @@ cl_boot(int argc, char **argv)
cl_object features;
int i;
if (ecl_booted) {
if (ecl_booted < 0) {
/* We have called cl_shutdown and want to use ECL again. */
ecl_booted = 1;
}
return;
}
#if !defined(GBC_BOEHM)
setbuf(stdin, stdin_buf);
setbuf(stdout, stdout_buf);