]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/dns_resolver: Mutex -> ceph::mutex
authorSage Weil <sage@redhat.com>
Tue, 16 Oct 2018 14:06:00 +0000 (09:06 -0500)
committerKefu Chai <kchai@redhat.com>
Wed, 21 Nov 2018 03:56:32 +0000 (11:56 +0800)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/dns_resolve.cc
src/common/dns_resolve.h

index 6b4a16db68f47d757510ba677e9f04e9dd753b9b..eb223a6836c2d0ccc4eaf863a65bae08bbdb3c07 100644 (file)
@@ -86,7 +86,7 @@ int DNSResolver::get_state(CephContext *cct, res_state *ps)
 
 void DNSResolver::put_state(res_state s)
 {
-  std::lock_guard<Mutex> l(lock);
+  std::lock_guard l(lock);
   states.push_back(s);
 }
 #endif
@@ -122,7 +122,7 @@ int DNSResolver::resolve_cname(CephContext *cct, const string& hostname,
 #else
   {
 # ifndef HAVE_THREAD_SAFE_RES_QUERY
-    std::lock_guard<Mutex> l(lock);
+    std::lock_guard l(lock);
 # endif
     len = resolv_h->res_query(origname, ns_c_in, ns_t_cname, buf, sizeof(buf));
   }
@@ -219,7 +219,7 @@ int DNSResolver::resolve_ip_addr(CephContext *cct, res_state *res, const string&
 #else
   {
 # ifndef HAVE_THREAD_SAFE_RES_QUERY
-    std::lock_guard<Mutex> l(lock);
+    std::lock_guard l(lock);
 # endif
     len = resolv_h->res_query(hostname.c_str(), ns_c_in, type, nsbuf, sizeof(nsbuf));
   }
@@ -295,7 +295,7 @@ int DNSResolver::resolve_srv_hosts(CephContext *cct, const string& service_name,
 #else
   {
 # ifndef HAVE_THREAD_SAFE_RES_QUERY
-    std::lock_guard<Mutex> l(lock);
+    std::lock_guard l(lock);
 # endif
     len = resolv_h->res_search(query_str.c_str(), ns_c_in, ns_t_srv, nsbuf,
         sizeof(nsbuf));
index e587224d84db7a9fe313c1bfc0a113ad4da25c3d..f5d94109c6e71c4ce3389a187b7825d34620110d 100644 (file)
@@ -17,7 +17,7 @@
 #include <netinet/in.h>
 #include <resolv.h>
 
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
 #include "msg/msg_types.h"             // for entity_addr_t
 
 namespace ceph {
@@ -126,10 +126,10 @@ class DNSResolver {
         std::map<std::string, Record> *srv_hosts);
 
   private:
-    DNSResolver() : lock("DNSResolver") { resolv_h = new ResolvHWrapper(); }
+    DNSResolver() { resolv_h = new ResolvHWrapper(); }
     ~DNSResolver();
 
-    Mutex lock;
+    ceph::mutex lock = ceph::make_mutex("DNSResolver::lock");
     ResolvHWrapper *resolv_h;
 #ifdef HAVE_RES_NQUERY
     std::list<res_state> states;