Skip to content

Commit

Permalink
Undo, not part of this PR
Browse files Browse the repository at this point in the history
  • Loading branch information
TrentHouliston committed Oct 26, 2024
1 parent 6b2e20d commit 4b2de78
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions tests/test_util/TestBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,13 @@ class TestBase : public NUClear::Reactor {
if (clean_shutdown) {
return;
}
std::unique_lock<std::mutex> lock(timeout_mutex);
timeout_cv.wait_for(lock, timeout);

if (should_shutdown) {
if (!clean_shutdown) {
powerplant.shutdown(true);
}
else {
std::unique_lock<std::mutex> lock(timeout_mutex);
timeout_cv.wait_for(lock, timeout);

if (!clean_shutdown) {
should_shutdown = true;
emit<Scope::INLINE>(
std::make_unique<Fail>("Test timed out after " + std::to_string(timeout.count()) + " ms"));
}
emit<Scope::INLINE>(
std::make_unique<Fail>("Test timed out after " + std::to_string(timeout.count()) + " ms"));
}
});

Expand All @@ -102,8 +96,7 @@ class TestBase : public NUClear::Reactor {
private:
std::mutex timeout_mutex;
std::condition_variable timeout_cv;
bool clean_shutdown = false;
bool should_shutdown = false;
bool clean_shutdown = false;
};

} // namespace test_util
Expand Down

0 comments on commit 4b2de78

Please sign in to comment.