]> Savannah Git Hosting - gnulib.git/commit
clean-temp: Make multithread-safe, part 2.
authorBruno Haible <bruno@clisp.org>
Sat, 4 Jul 2020 12:39:09 +0000 (14:39 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 4 Jul 2020 12:39:09 +0000 (14:39 +0200)
commit9d1ad9c4df04071810d04dcc3142dfdeb5a5f892
treed59713b40bf8cc09eea58ba1545bf0009f390600
parent856995cf27edc742b6aa34fd54466d2c4ed50329
clean-temp: Make multithread-safe, part 2.

* lib/fatal-signal.h: Include <signal.h>.
(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.
ChangeLog
lib/clean-temp.c
lib/fatal-signal.c
lib/fatal-signal.h
modules/clean-temp