summaryrefslogtreecommitdiff
path: root/deps/jemalloc/test/include/test/bgthd.h
blob: 4fa2395e503ab8c710cb896050b6ad7eb61ad671 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * 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;
}