1 | | Hi I don't understand the purpose of your test. You are constructing twice an object on the same address. What is the interest of such a test? |
| 1 | If I understand correctly, you are expecting that the destructor of the thread_specific_ptr must reset the thread specific pointer for all the threads that are using this key. |
| 2 | |
| 3 | IMO, the user must ensure that the thread_specific_pointer instance outlives all the threads that are using it. Otherwise, the library needs to maintain a list of all the threads that are using a specific key, which goes against the purpose of tss to reduce the contention between threads by accessing a thread specific and not a global data. |
| 4 | |
| 5 | The documentation must state clearly this constraint (design principle). |
| 6 | Note that pthread works already in this way. |