summaryrefslogtreecommitdiff
path: root/src/components/utils/test/conditional_variable_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/utils/test/conditional_variable_test.cc')
-rw-r--r--src/components/utils/test/conditional_variable_test.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/components/utils/test/conditional_variable_test.cc b/src/components/utils/test/conditional_variable_test.cc
index 524d53cafa..1ef29685e6 100644
--- a/src/components/utils/test/conditional_variable_test.cc
+++ b/src/components/utils/test/conditional_variable_test.cc
@@ -30,14 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <iostream>
#include <pthread.h>
+#include <iostream>
#include "gtest/gtest.h"
+#include "utils/conditional_variable.h"
#include "utils/lock.h"
#include "utils/macro.h"
-#include "utils/conditional_variable.h"
namespace test {
namespace components {
@@ -61,8 +61,8 @@ class ConditionalVariableTest : public ::testing::Test {
protected:
std::string test_value_;
- sync_primitives::ConditionalVariable cond_var_;
sync_primitives::Lock test_mutex_;
+ sync_primitives::ConditionalVariable cond_var_;
unsigned counter_;
};
@@ -102,6 +102,7 @@ TEST_F(ConditionalVariableTest,
cond_var_.WaitFor(test_lock, 2000);
std::string last_value("changed again by thread 1");
EXPECT_EQ(last_value, test_value_);
+ pthread_join(thread1, NULL);
}
TEST_F(ConditionalVariableTest,
@@ -116,6 +117,8 @@ TEST_F(ConditionalVariableTest,
ASSERT_FALSE(thread_created) << "thread2 is not created!";
check_counter();
EXPECT_EQ(2u, counter_);
+ pthread_join(thread1, NULL);
+ pthread_join(thread2, NULL);
}
TEST_F(