mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-11 00:07:17 +03:00
Fix an interaction between the oversize_threshold test and bgthds.
Also added the shared utility to check if background_thread is enabled.
This commit is contained in:
parent
5417938215
commit
08089589f7
6 changed files with 30 additions and 34 deletions
17
test/include/test/bgthd.h
Normal file
17
test/include/test/bgthd.h
Normal file
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -128,6 +128,7 @@ static const bool config_debug =
|
|||
#include "test/test.h"
|
||||
#include "test/timer.h"
|
||||
#include "test/thd.h"
|
||||
#include "test/bgthd.h"
|
||||
#define MEXP 19937
|
||||
#include "test/SFMT.h"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue