From 5510a76dca2824c8700c885b74cb6d47152f7227 Mon Sep 17 00:00:00 2001 From: Leif Andersen Date: Sun, 4 Jun 2017 08:56:07 -0400 Subject: [PATCH] scheme_add_atexit_closer now uses scheme_atexit. This is because calling atexit is not correct in all situations, namely on old operating systems. --- racket/src/racket/src/thread.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/racket/src/racket/src/thread.c b/racket/src/racket/src/thread.c index 668ab4e1e6..be1fda08f0 100644 --- a/racket/src/racket/src/thread.c +++ b/racket/src/racket/src/thread.c @@ -1966,15 +1966,7 @@ void scheme_add_atexit_closer(Scheme_Exit_Closer_Func f) if (!cust_closers) { if (RUNNING_IN_ORIGINAL_PLACE) { - if (replacement_at_exit) { - replacement_at_exit(do_run_atexit_closers_on_all); - } else { -#ifdef USE_ON_EXIT_FOR_ATEXIT - on_exit(do_run_atexit_closers_on_all, NULL); -#else - atexit(do_run_atexit_closers_on_all); -#endif - } + scheme_atexit(do_run_atexit_closers_on_all); } REGISTER_SO(cust_closers); @@ -1986,7 +1978,15 @@ void scheme_add_atexit_closer(Scheme_Exit_Closer_Func f) int scheme_atexit(void (*func)(void)) { - return atexit(func); + if (replacement_at_exit) { + return replacement_at_exit(func); + } else { +#ifdef USE_ON_EXIT_FOR_ATEXIT + return on_exit(func, NULL); +#else + return atexit(func); +#endif + } } void scheme_schedule_custodian_close(Scheme_Custodian *c)