As non trivial thread local storage variables have an overhead, I would like to use the __attribute__((constructor))
indication on some function in order to initialize thread local data ( being intended that the function will be called each time a thread starts ).
Is that some how possible ?
Asked
Active
Viewed 222 times
0

George Kourtis
- 2,381
- 3
- 18
- 28
1 Answers
1
You cannot use __attribute__((constructor))
in that manner. There is no option to designate a function to be called by TLS automatically each time a new thread starts. You will have to code it manually using lazy initialization instead.

Community
- 1
- 1

Remy Lebeau
- 555,201
- 31
- 458
- 770