summaryrefslogtreecommitdiffstats
path: root/deps/jemalloc/test/include/test/bgthd.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/jemalloc/test/include/test/bgthd.h')
-rw-r--r--deps/jemalloc/test/include/test/bgthd.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/deps/jemalloc/test/include/test/bgthd.h b/deps/jemalloc/test/include/test/bgthd.h
new file mode 100644
index 0000000..4fa2395
--- /dev/null
+++ b/deps/jemalloc/test/include/test/bgthd.h
@@ -0,0 +1,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;
+}