mirror of
https://github.com/fluencelabs/redis
synced 2025-06-14 01:31:21 +00:00
28
deps/jemalloc/src/tsd.c
vendored
28
deps/jemalloc/src/tsd.c
vendored
@ -77,7 +77,7 @@ tsd_cleanup(void *arg)
|
||||
/* Do nothing. */
|
||||
break;
|
||||
case tsd_state_nominal:
|
||||
#define O(n, t) \
|
||||
#define O(n, t) \
|
||||
n##_cleanup(tsd);
|
||||
MALLOC_TSD
|
||||
#undef O
|
||||
@ -106,17 +106,15 @@ MALLOC_TSD
|
||||
}
|
||||
}
|
||||
|
||||
tsd_t *
|
||||
bool
|
||||
malloc_tsd_boot0(void)
|
||||
{
|
||||
tsd_t *tsd;
|
||||
|
||||
ncleanups = 0;
|
||||
if (tsd_boot0())
|
||||
return (NULL);
|
||||
tsd = tsd_fetch();
|
||||
*tsd_arenas_tdata_bypassp_get(tsd) = true;
|
||||
return (tsd);
|
||||
return (true);
|
||||
*tsd_arenas_cache_bypassp_get(tsd_fetch()) = true;
|
||||
return (false);
|
||||
}
|
||||
|
||||
void
|
||||
@ -124,7 +122,7 @@ malloc_tsd_boot1(void)
|
||||
{
|
||||
|
||||
tsd_boot1();
|
||||
*tsd_arenas_tdata_bypassp_get(tsd_fetch()) = false;
|
||||
*tsd_arenas_cache_bypassp_get(tsd_fetch()) = false;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -150,15 +148,13 @@ _tls_callback(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
#ifdef _MSC_VER
|
||||
# ifdef _M_IX86
|
||||
# pragma comment(linker, "/INCLUDE:__tls_used")
|
||||
# pragma comment(linker, "/INCLUDE:_tls_callback")
|
||||
# else
|
||||
# pragma comment(linker, "/INCLUDE:_tls_used")
|
||||
# pragma comment(linker, "/INCLUDE:tls_callback")
|
||||
# endif
|
||||
# pragma section(".CRT$XLY",long,read)
|
||||
#endif
|
||||
JEMALLOC_SECTION(".CRT$XLY") JEMALLOC_ATTR(used)
|
||||
BOOL (WINAPI *const tls_callback)(HINSTANCE hinstDLL,
|
||||
static BOOL (WINAPI *const tls_callback)(HINSTANCE hinstDLL,
|
||||
DWORD fdwReason, LPVOID lpvReserved) = _tls_callback;
|
||||
#endif
|
||||
|
||||
@ -171,10 +167,10 @@ tsd_init_check_recursion(tsd_init_head_t *head, tsd_init_block_t *block)
|
||||
tsd_init_block_t *iter;
|
||||
|
||||
/* Check whether this thread has already inserted into the list. */
|
||||
malloc_mutex_lock(TSDN_NULL, &head->lock);
|
||||
malloc_mutex_lock(&head->lock);
|
||||
ql_foreach(iter, &head->blocks, link) {
|
||||
if (iter->thread == self) {
|
||||
malloc_mutex_unlock(TSDN_NULL, &head->lock);
|
||||
malloc_mutex_unlock(&head->lock);
|
||||
return (iter->data);
|
||||
}
|
||||
}
|
||||
@ -182,7 +178,7 @@ tsd_init_check_recursion(tsd_init_head_t *head, tsd_init_block_t *block)
|
||||
ql_elm_new(block, link);
|
||||
block->thread = self;
|
||||
ql_tail_insert(&head->blocks, block, link);
|
||||
malloc_mutex_unlock(TSDN_NULL, &head->lock);
|
||||
malloc_mutex_unlock(&head->lock);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@ -190,8 +186,8 @@ void
|
||||
tsd_init_finish(tsd_init_head_t *head, tsd_init_block_t *block)
|
||||
{
|
||||
|
||||
malloc_mutex_lock(TSDN_NULL, &head->lock);
|
||||
malloc_mutex_lock(&head->lock);
|
||||
ql_remove(&head->blocks, block, link);
|
||||
malloc_mutex_unlock(TSDN_NULL, &head->lock);
|
||||
malloc_mutex_unlock(&head->lock);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user