Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
Description
Every major compiler has some notion of thread local storage
In C++11, there is thread_local , as per standard.
In C, in the newer standards, it is _Thread_local (C11) , or thread_local (C23) , and before that all relevant compiler have had notion of "thread local variable" for many years , i.e __thread in GCC or __declspec(thread) in MSVC,
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.
"/tmp/workspace/Source-Build-Test/src/storage/perfschema/pfs.cc", line=line@entry=1379, function=function@entry=0xaaaad18df558 "void my_thread_set_THR_PFS(PFS_thread*)") at assert.c:92
|
#7 0x0000ffffa19e9684 in __GI___assert_fail (assertion=0xaaaad18df508 "THR_PFS_initialized", file=0xaaaad18df4c8 "/tmp/workspace/Source-Build-Test/src/storage/perfschema/pfs.cc", line=1379, function=0xaaaad18df558 "void my_thread_set_THR_PFS(PFS_thread*)") at assert.c:101
|
Attachments
Issue Links
- relates to
-
MDEV-30811 Build issues on macOS 11.0
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue relates to |
Summary | get rid of pthread_key_xxx API, replace with C-style thread_local | get rid of pthread_key_(get_/set_)specific API, replace with C-style thread_local |
Description |
Every major compiler has some notion of thread local storage
In C++11, there is thread_local , as per standard. In C, in the newer standards, it is _Thread_local (C11) , or thread_local (C23) , and before that all relevant compiler have had notion of "thread local variable" for many years , i.e __thread in GCC or __declspec(thread) in MSVC, Apart from better performance when accessing thread local variables, we'll get rid of things like below {noformat} "/tmp/workspace/Source-Build-Test/src/storage/perfschema/pfs.cc", line=line@entry=1379, function=function@entry=0xaaaad18df558 "void my_thread_set_THR_PFS(PFS_thread*)") at assert.c:92 #7 0x0000ffffa19e9684 in __GI___assert_fail (assertion=0xaaaad18df508 "THR_PFS_initialized", file=0xaaaad18df4c8 "/tmp/workspace/Source-Build-Test/src/storage/perfschema/pfs.cc", line=1379, function=0xaaaad18df558 "void my_thread_set_THR_PFS(PFS_thread*)") at assert.c:101 {noformat} |
Every major compiler has some notion of thread local storage
In C++11, there is thread_local , as per standard. In C, in the newer standards, it is _Thread_local (C11) , or thread_local (C23) , and before that all relevant compiler have had notion of "thread local variable" for many years , i.e __thread in GCC or __declspec(thread) in MSVC, 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. {noformat} "/tmp/workspace/Source-Build-Test/src/storage/perfschema/pfs.cc", line=line@entry=1379, function=function@entry=0xaaaad18df558 "void my_thread_set_THR_PFS(PFS_thread*)") at assert.c:92 #7 0x0000ffffa19e9684 in __GI___assert_fail (assertion=0xaaaad18df508 "THR_PFS_initialized", file=0xaaaad18df4c8 "/tmp/workspace/Source-Build-Test/src/storage/perfschema/pfs.cc", line=1379, function=0xaaaad18df558 "void my_thread_set_THR_PFS(PFS_thread*)") at assert.c:101 {noformat} |
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Vladislav Vaintroub [ wlad ] | Nikita Malyavin [ nikitamalyavin ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Assignee | Nikita Malyavin [ nikitamalyavin ] | Vladislav Vaintroub [ wlad ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
issue.field.resolutiondate | 2024-06-21 12:35:58.0 | 2024-06-21 12:35:58.248 |
Component/s | Server [ 13907 ] | |
Fix Version/s | 11.6.1 [ 29847 ] | |
Fix Version/s | 11.6 [ 29515 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
The last solution is lovely.
Especially given that LTO is now fixed per
MDEV-25633, it's efficient enough.As discussed, there's a small improvement window for shared objects, to eliminate an extra function call, but there's no shared object access to mysys_var at all.
Ok to push, to mention.
Thank you wlad!