From 9d1ad9c4df04071810d04dcc3142dfdeb5a5f892 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 4 Jul 2020 14:39:09 +0200 Subject: clean-temp: Make multithread-safe, part 2. * lib/fatal-signal.h: Include . (get_fatal_signal_set): New declaration. * lib/fatal-signal.c (get_fatal_signal_set): New function. * lib/clean-temp.c: Include asyncsafe-spin.h, gl_linked_list.h. (struct closeable_fd): New type. (fatal_signal_set): New variable. (init_fatal_signal_set): New function. (asyncsafe_close, asyncsafe_fclose_variant): New functions. (cleanup_action): Invoke asyncsafe_close instead of close. (create_temp_dir): Invoke init_fatal_signal_set. (register_fd): Use a plain linked list. Add a 'struct closeable_fd *' element. (unregister_fd): Remove function. (close_temp): Cleanup descriptors list on the fly. Invoke init_fatal_signal_set. Invoke asyncsafe_close instead of close. (fclose_variant_temp): New function. (fclose_temp, fwriteerror_temp, close_stream_temp): Use it. * modules/clean-temp (Depends-on): Add asyncsafe-spin, linked-list. --- modules/clean-temp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules/clean-temp') diff --git a/modules/clean-temp b/modules/clean-temp index c1d5c1c4b5..940869de4e 100644 --- a/modules/clean-temp +++ b/modules/clean-temp @@ -12,6 +12,7 @@ unistd lock error fatal-signal +asyncsafe-spin open pathmax tmpdir @@ -20,6 +21,7 @@ rmdir xalloc xmalloca linkedhash-list +linked-list xlist gettext-h -- cgit v1.2.1