Fix flake in mutex_test due to threading
gtest's detection of multiple threads isn't perfect and sometimes
detects that the joined thread is still running. There is no reason to
create the thread before the fork, so just don't.
Change-Id: I44318cef5876ecb4744b846d75260c09fd152bac
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/mutex/mutex_test.cc b/aos/mutex/mutex_test.cc
index 54e9201..8d10b26 100644
--- a/aos/mutex/mutex_test.cc
+++ b/aos/mutex/mutex_test.cc
@@ -241,10 +241,11 @@
static_cast<Mutex *>(shm_malloc_aligned(sizeof(Mutex), alignof(Mutex)));
new (mutex) Mutex();
- std::thread thread([&]() { ASSERT_FALSE(mutex->Lock()); });
- thread.join();
EXPECT_DEATH(
{
+ std::thread thread([&]() { ASSERT_FALSE(mutex->Lock()); });
+ thread.join();
+
logging::SetImplementation(
std::make_shared<util::DeathTestLogImplementation>());
MutexLocker locker(mutex);