| 322 | #if (!defined(JEMALLOC_MALLOC_THREAD_CLEANUP) && !defined(JEMALLOC_TLS) && \ |
| 323 | !defined(_WIN32)) |
| 324 | void * |
| 325 | tsd_init_check_recursion(tsd_init_head_t *head, tsd_init_block_t *block) { |
| 326 | pthread_t self = pthread_self(); |
| 327 | tsd_init_block_t *iter; |
| 328 | |
| 329 | /* Check whether this thread has already inserted into the list. */ |
| 330 | malloc_mutex_lock(TSDN_NULL, &head->lock); |
| 331 | ql_foreach(iter, &head->blocks, link) { |
| 332 | if (iter->thread == self) { |
| 333 | malloc_mutex_unlock(TSDN_NULL, &head->lock); |
| 334 | return iter->data; |
| 335 | } |
| 336 | } |
| 337 | /* Insert block into list. */ |
| 338 | ql_elm_new(block, link); |
| 339 | block->thread = self; |
| 340 | ql_tail_insert(&head->blocks, block, link); |
| 341 | malloc_mutex_unlock(TSDN_NULL, &head->lock); |
| 342 | return NULL; |
| 343 | } |
| 344 | |
| 345 | void |
| 346 | tsd_init_finish(tsd_init_head_t *head, tsd_init_block_t *block) { |
no test coverage detected