Re: [PATCH] At-exit hook

2024-11-08 Thread Mikael Djurfeldt
Hi all, I've come to the conclusion that this problem is unsolvable and I will abandon the idea of an at-exit-hook. The most serious potential consequence of running it in really_cleanup_for_exit(), which is indirectly invoked through atexit(), is that the resources to clean up or the Guile librar

RE: [PATCH] At-exit hook

2024-11-07 Thread Maxime Devos
On Thu, 7 Nov 2024 17:10:45 +0100 Maxime Devos wrote: > On Thu, 7 Nov 2024 12:23:08 +0100 > >Maxime Devos wrote: > >> ‘atexit’ functions are run at ‘exit’. ‘exit’ can be run from signal > >> handlers (*). Since the hook runs Scheme code, it could do a lot of > >> AC-unsafe things, resulting in p

Re: [PATCH] At-exit hook

2024-11-07 Thread Mailer
On Thu, 7 Nov 2024 17:10:45 +0100 Maxime Devos wrote: > On Thu, 7 Nov 2024 12:23:08 +0100 > >Maxime Devos wrote: > >> ‘atexit’ functions are run at ‘exit’. ‘exit’ can be run from signal > >> handlers (*). Since the hook runs Scheme code, it could do a lot of > >> AC-unsafe things, resulting in p

RE: [PATCH] At-exit hook

2024-11-07 Thread Maxime Devos
On Thu, 7 Nov 2024 12:23:08 +0100 >Maxime Devos wrote: >> ‘atexit’ functions are run at ‘exit’. ‘exit’ can be run from signal >> handlers (*). Since the hook runs Scheme code, it could do a lot of >> AC-unsafe things, resulting in problems. >> >> (*) glibc documentation says ‘exit’ is AC-unsafe,

Re: [PATCH] At-exit hook

2024-11-07 Thread Mikael Djurfeldt
OK, so people have brought up two issues: 1. It is for various reasons not recommended to call atexit() from a dynamically linked library (which Guile already does before my suggested change, n.b.). 2. It is not async signal safe. A suggested remedy would then be: Instead of calling the at-exit

Re: [PATCH] At-exit hook

2024-11-07 Thread Mailer
On Thu, 7 Nov 2024 12:09:25 + Mailer wrote: > On Thu, 7 Nov 2024 12:23:08 +0100 > Maxime Devos wrote: > > ‘atexit’ functions are run at ‘exit’. ‘exit’ can be run from signal > > handlers (*). Since the hook runs Scheme code, it could do a lot of > > AC-unsafe things, resulting in problems. >

Re: [PATCH] At-exit hook

2024-11-07 Thread Nala Ginrut
How about using sigprocmask to disable async signals temporarily? On Thu, Nov 7, 2024 at 8:23 PM Maxime Devos wrote: > ‘atexit’ functions are run at ‘exit’. ‘exit’ can be run from signal > handlers (*). Since the hook runs Scheme code, it could do a lot of > AC-unsafe things, resulting in probl

Re: [PATCH] At-exit hook

2024-11-07 Thread Mailer
On Thu, 7 Nov 2024 12:23:08 +0100 Maxime Devos wrote: > ‘atexit’ functions are run at ‘exit’. ‘exit’ can be run from signal > handlers (*). Since the hook runs Scheme code, it could do a lot of > AC-unsafe things, resulting in problems. > > (*) glibc documentation says ‘exit’ is AC-unsafe, but th

RE: [PATCH] At-exit hook

2024-11-07 Thread Maxime Devos
‘atexit’ functions are run at ‘exit’. ‘exit’ can be run from signal handlers (*). Since the hook runs Scheme code, it could do a lot of AC-unsafe things, resulting in problems. (*) glibc documentation says ‘exit’ is AC-unsafe, but this is unsupported by POSIX AFAICT. OTOH the same applies to ev

[PATCH] At-exit hook

2024-11-06 Thread Mikael Djurfeldt
Hi, I think it would be good to have an at-exit-hook which is run atexit(). The motivation is that Guile can provide bindings for libraries which may want to clean up resources at exit. If the at-exit-hook exists, this would then be one way to make sure that the linked in library can do this at ex