mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-13 16:36:21 +03:00
17 lines
425 B
C
17 lines
425 B
C
/*
|
|
* Shared utility for checking if background_thread is enabled, which affects
|
|
* the purging behavior and assumptions in some tests.
|
|
*/
|
|
|
|
static inline bool
|
|
is_background_thread_enabled(void) {
|
|
bool enabled;
|
|
size_t sz = sizeof(bool);
|
|
int ret = mallctl("background_thread", (void *)&enabled, &sz, NULL, 0);
|
|
if (ret == ENOENT) {
|
|
return false;
|
|
}
|
|
assert_d_eq(ret, 0, "Unexpected mallctl error");
|
|
|
|
return enabled;
|
|
}
|