MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tsd_init_check_recursion

Function tsd_init_check_recursion

app/redis-6.2.6/deps/jemalloc/src/tsd.c:324–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322#if (!defined(JEMALLOC_MALLOC_THREAD_CLEANUP) && !defined(JEMALLOC_TLS) && \
323 !defined(_WIN32))
324void *
325tsd_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
345void
346tsd_init_finish(tsd_init_head_t *head, tsd_init_block_t *block) {

Callers 1

tsd_generic.hFile · 0.85

Calls 3

malloc_mutex_lockFunction · 0.85
ql_foreachFunction · 0.85
malloc_mutex_unlockFunction · 0.85

Tested by

no test coverage detected