1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-33748 get rid of pthread_(get_/set_)specific, use thread_local

Apart from better performance when accessing thread local variables,
we'll get rid of things that depend on initialization/cleanup of
pthread_key_t variables.

Where appropriate, use compiler-dependent pre-C++11 thread-local
equivalents, where it makes sense, to avoid initialization check overhead
that non-static thread_local can suffer from.
This commit is contained in:
Vladislav Vaintroub
2024-06-07 16:20:10 +02:00
parent 68fed7e785
commit 7c5fdc9b6a
26 changed files with 93 additions and 234 deletions

View File

@@ -183,4 +183,16 @@ rarely invoked function for size instead for speed. */
#include <my_attribute.h>
/*
C++11 thread_local incurs a performance penalty on some platforms
accessing "extern thread_local" variable (not static).
To workaround, we use the platform specific thread local
storage mechanism, which also available in plain C.
*/
#if defined (_MSC_VER)
# define MY_THREAD_LOCAL __declspec(thread)
#else
# define MY_THREAD_LOCAL __thread
#endif
#endif /* MY_COMPILER_INCLUDED */