Skip to content

Commit

Permalink
Fixed potential deadlock in async_tests.h
Browse files Browse the repository at this point in the history
  • Loading branch information
4c3y committed Sep 7, 2023
1 parent 7076dc7 commit 08ce02f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions test/common/async_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TestResult {
* @return true on success otherwise false
*/
inline bool get(const std::string &test_name) {
test_result_mutex_.lock();
std::scoped_lock<std::mutex> lock(test_result_mutex_);
LOG_INIT(*test_argv);
if (!started_) {
started_ = true;
Expand All @@ -56,7 +56,6 @@ class TestResult {
}

bool res = test_results.at(test_name);
test_result_mutex_.unlock();
return res;
}

Expand Down

0 comments on commit 08ce02f

Please sign in to comment.