|
From: | Bruno Haible |
Subject: | new module 'thread-optim' |
Date: | Sat, 08 Aug 2020 22:26:56 +0200 |
User-agent: | KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; ) |
The glibc 2.32 announcement says: Using weak references to libpthread functions such as pthread_create or pthread_key_create to detect the singled-threaded nature of a program is an obsolescent feature. Future versions of glibc will define pthread_create within libc.so.6 itself, so such checks will always flag the program as multi-threaded. Applications should check the __libc_single_threaded variable declared in <sys/single_threaded.h> instead. See also <https://www.gnu.org/software/libc/manual/html_node/Single_002dThreaded.html>. So, this means, the pthread_in_use() macro will evaluate to 1 always in some future versions of glibc. The new __libc_single_threaded variable is not a full replacement for this. In these future glibc versions, - It will not be possible to skip the initialization of locks, only the lock/unlock operations - because some part of the program may create a thread, and then __libc_single_threaded changes from 1 to 0. - Optimization of TLS (pthread_getspecific and pthread_setspecific functions) is hairy as well. Let me add support for this technique to some gnulib modules. 'regex' could use the same technique as well. May I leave this to you, Paul? 2020-08-08 Bruno Haible <bruno@clisp.org> localename: Use module 'thread-optim'. * lib/localename.c: Include thread-optim.h. (struniq): Use IF_MT macro. * modules/localename (Depends-on): Add thread-optim. clean-temp: Use module 'thread-optim'. * lib/clean-temp.c: Include thread-optim.h. (register_temporary_file, unregister_temporary_file, create_temp_dir, register_temp_file, unregister_temp_file, register_temp_subdir, unregister_temp_subdir, cleanup_temp_dir_contents, register_fd, close_temp, fclose_variant_temp): Use IF_MT macro. * modules/clean-temp (Depends-on): Add thread-optim. fatal-signal: Use module 'thread-optim'. * lib/fatal-signal.c: Include thread-optim.h. (at_fatal_signal, block_fatal_signals, unblock_fatal_signals): Use IF_MT macro. * modules/fatal-signal (Depends-on): Add thread-optim.
0001-New-module-thread-optim.patch
Description: Text Data
0002-fatal-signal-Use-module-thread-optim.patch
Description: Text Data
0003-clean-temp-Use-module-thread-optim.patch
Description: Text Data
0004-localename-Use-module-thread-optim.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |