]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/testmsgr: s/Mutex/ceph::mutex/
authorKefu Chai <kchai@redhat.com>
Thu, 18 Jul 2019 13:38:02 +0000 (21:38 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 3 Aug 2019 03:27:21 +0000 (11:27 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/testmsgr.cc

index 85690900ef4cb6838a23480f3957a9161292e747..3ff2ed7de9cc33b17e1c73fb293dc2d88cd36ceb 100644 (file)
@@ -35,8 +35,8 @@ using namespace std;
 
 Messenger *messenger = 0;
 
-Mutex test_lock("mylock");
-Cond cond;
+ceph::mutex test_lock = ceph::make_mutex("mylock");
+ceph::condition_variable cond;
 
 uint64_t received = 0;
 
@@ -51,10 +51,10 @@ private:
 
     //cerr << "got ping from " << m->get_source() << std::endl;
     dout(0) << "got ping from " << m->get_source() << dendl;
-    test_lock.Lock();
+    test_lock.lock();
     ++received;
-    cond.Signal();
-    test_lock.Unlock();
+    cond.notify_all();
+    test_lock.unlock();
 
     m->put();
     return true;
@@ -112,13 +112,13 @@ int main(int argc, const char **argv, const char *envp[]) {
   if (whoami == 0)
     isend = 100;
 
-  test_lock.Lock();
+  std::unique_lock l{test_lock};
   uint64_t sent = 0;
   while (1) {
     while (received + isend <= sent) {
       //cerr << "wait r " << received << " s " << sent << " is " << isend << std::endl;
       dout(0) << "wait r " << received << " s " << sent << " is " << isend << dendl;
-      cond.Wait(test_lock);
+      cond.wait(l);
     }
 
     int t = rand() % mc.get_num_mon();
@@ -135,7 +135,7 @@ int main(int argc, const char **argv, const char *envp[]) {
     messenger->send_to_mon(new MPing, mc.get_mon_addrs(t));
     cerr << isend << "\t" << ++sent << "\t" << received << "\r";
   }
-  test_lock.Unlock();
+  l.unlock();
 
   // wait for messenger to finish
   rank->wait();