From 4e7d0be93f2a853940e256b26ae7028bc7d59ccc Mon Sep 17 00:00:00 2001 From: Jonathan Marsden Date: Tue, 7 Nov 2017 11:49:05 -0800 Subject: [PATCH] Prevent crash when repeating test in a tight loop --- src/autowiring/test/CoreThreadTest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/autowiring/test/CoreThreadTest.cpp b/src/autowiring/test/CoreThreadTest.cpp index c1c7347fa..4b5c84f55 100644 --- a/src/autowiring/test/CoreThreadTest.cpp +++ b/src/autowiring/test/CoreThreadTest.cpp @@ -484,7 +484,8 @@ class CoreThreadExtraction: }; TEST_F(CoreThreadTest, SpuriousWakeupTest) { - AutoCurrentContext()->Initiate(); + AutoCurrentContext ctxt; + ctxt->Initiate(); AutoRequired extraction; std::mutex lock; @@ -518,6 +519,8 @@ TEST_F(CoreThreadTest, SpuriousWakeupTest) { ASSERT_TRUE(cv.wait_for(lk, std::chrono::seconds(5), [&] { return ready; })); ASSERT_EQ(2UL, countOnWake) << "Dispatch queue changed size under a spurious wakeup condition"; + + ctxt->SignalShutdown(true); } class BlocksInOnStop: