When we claim a free slot, we increase the global version counter (so if we reuse a slot it will be returning NULL initially when a thread tries to get it)
| 172 | // When we claim a free slot, we increase the global version counter |
| 173 | // (so if we reuse a slot it will be returning NULL initially when a thread tries to get it) |
| 174 | static mi_thread_local_t mi_thread_local_claim(void) { |
| 175 | size_t idx = 0; |
| 176 | if (mi_thread_locals_free != NULL && mi_bitmap_try_find_and_claim(mi_thread_locals_free,0,&idx,&mi_thread_local_claim_fun,NULL)) { |
| 177 | mi_thread_locals_version++; |
| 178 | if (mi_thread_locals_version == SIZE_MAX/2) { mi_thread_locals_version = 1; } |
| 179 | return mi_key_create( idx, mi_thread_locals_version); |
| 180 | } |
| 181 | else { |
| 182 | return 0; |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | static bool mi_thread_local_create_expand(void) { |
| 187 | mi_bitmap_t* slots = mi_thread_locals_free; |
no test coverage detected