Fix a background_thread shutdown issue.

1) make sure background thread 0 is always created; and 2) fix synchronization
between thread 0 and the control thread.
This commit is contained in:
Qi Wang
2018-03-30 15:09:05 -07:00
committed by Qi Wang
parent 956c4ad6b5
commit 21eb0d15a6
2 changed files with 29 additions and 21 deletions

View File

@@ -24,6 +24,9 @@ TEST_BEGIN(test_deferred) {
size_t sz_b = sizeof(bool);
assert_d_eq(mallctl("background_thread", NULL, NULL, &enable, sz_b), 0,
"Failed to enable background threads");
enable = false;
assert_d_eq(mallctl("background_thread", NULL, NULL, &enable, sz_b), 0,
"Failed to disable background threads");
}
TEST_END