Skip to content

Commit

Permalink
Prevent crash when repeating test in a tight loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marsden committed Nov 7, 2017
1 parent c12221e commit 4e7d0be
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/autowiring/test/CoreThreadTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ class CoreThreadExtraction:
};

TEST_F(CoreThreadTest, SpuriousWakeupTest) {
AutoCurrentContext()->Initiate();
AutoCurrentContext ctxt;
ctxt->Initiate();
AutoRequired<CoreThreadExtraction> extraction;

std::mutex lock;
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4e7d0be

Please sign in to comment.