| 485 | #if (!defined(JEMALLOC_MALLOC_THREAD_CLEANUP) && !defined(JEMALLOC_TLS) && \ |
| 486 | !defined(_WIN32)) |
| 487 | void * |
| 488 | tsd_init_check_recursion(tsd_init_head_t *head, tsd_init_block_t *block) { |
| 489 | pthread_t self = pthread_self(); |
| 490 | tsd_init_block_t *iter; |
| 491 | |
| 492 | /* Check whether this thread has already inserted into the list. */ |
| 493 | malloc_mutex_lock(TSDN_NULL, &head->lock); |
| 494 | ql_foreach(iter, &head->blocks, link) { |
| 495 | if (iter->thread == self) { |
| 496 | malloc_mutex_unlock(TSDN_NULL, &head->lock); |
| 497 | return iter->data; |
| 498 | } |
| 499 | } |
| 500 | /* Insert block into list. */ |
| 501 | ql_elm_new(block, link); |
| 502 | block->thread = self; |
| 503 | ql_tail_insert(&head->blocks, block, link); |
| 504 | malloc_mutex_unlock(TSDN_NULL, &head->lock); |
| 505 | return NULL; |
| 506 | } |
| 507 | |
| 508 | void |
| 509 | tsd_init_finish(tsd_init_head_t *head, tsd_init_block_t *block) { |
no test coverage detected