From 3f171e401039d8ad5c61966277b76d8e05904e32 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 26 Oct 2017 17:34:23 +0800 Subject: [PATCH] test/librados/cmd.cc: avoid using non-librados facilities a test for librados should be only depending on librados Signed-off-by: Kefu Chai --- src/test/librados/cmd.cc | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/test/librados/cmd.cc b/src/test/librados/cmd.cc index 0db73471326..043d98328f5 100644 --- a/src/test/librados/cmd.cc +++ b/src/test/librados/cmd.cc @@ -1,18 +1,14 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab -#include "mds/mdstypes.h" -#include "include/buffer.h" -#include "include/rbd_types.h" #include "include/rados/librados.h" #include "include/rados/librados.hpp" #include "include/stringify.h" #include "test/librados/test.h" -#include "common/Cond.h" - #include "gtest/gtest.h" #include +#include #include #include #include @@ -238,13 +234,11 @@ TEST(LibRadosCmd, PGCmdPP) { struct Log { list log; - Cond cond; - Mutex lock; - - Log() : lock("l::lock") {} + std::condition_variable cond; + std::mutex lock; - bool contains(string str) { - Mutex::Locker l(lock); + bool contains(const string& str) { + std::lock_guard l(lock); for (list::iterator p = log.begin(); p != log.end(); ++p) { if (p->find(str) != std::string::npos) return true; @@ -259,9 +253,9 @@ void log_cb(void *arg, uint64_t seq, const char *level, const char *msg) { Log *l = static_cast(arg); - Mutex::Locker locker(l->lock); + std::lock_guard locker(l->lock); l->log.push_back(line); - l->cond.Signal(); + l->cond.notify_all(); cout << "got: " << line << std::endl; } -- 2.39.5