On 10/8/24 17:03, jseigh wrote:
On 10/7/24 12:03, jseigh wrote:
tss_create lets you dynamically create thread local storage.
thread_local is static. Gets resolved at ld time. Doesn't
work too well if you want a per object instance of thread
local storage. Something like that in C++?
Joe Seigh
I figured something out so all good I think.
So basically just declare a thread local array. It will have
fixed size and you will have to manage allocation of array
slots and dtors and stuff. E.g.
thread_local void * x2[20];
Accessing a slot value, if you inline it with a uint64_t
key on x86 will get you something like
movq %fs:x2@tpoff(,%rax,8), %rdx
with %rax containing the index, i.e. the key,
which will beat calling tss_get which calls
pthread_getspecific.
Joe Seigh
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)