From e88418f1c16c8768f71da47b64e57cb7163dae63 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Tue, 15 Oct 2019 12:52:52 +0300 Subject: [PATCH] use thread_local --- src/lib/dhcp/libdhcp++.cc | 2 +- src/lib/dhcpsrv/alloc_engine.cc | 2 +- src/lib/dhcpsrv/alloc_engine.h | 2 +- src/lib/dhcpsrv/thread_pool.h | 10 +++++----- src/lib/dhcpsrv/thread_resource_mgr.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/dhcp/libdhcp++.cc b/src/lib/dhcp/libdhcp++.cc index 51de725607..56c0fa6d3e 100644 --- a/src/lib/dhcp/libdhcp++.cc +++ b/src/lib/dhcp/libdhcp++.cc @@ -89,7 +89,7 @@ void initOptionSpace(OptionDefContainerPtr& defs, const OptionDefContainerPtr& LibDHCP::getOptionDefs(const std::string& space) { static mutex local_mutex; - std::lock_guard lock(&local_mutex); + std::lock_guard lock(local_mutex); // If any of the containers is not initialized, it means that we haven't // initialized option definitions at all. if (option_defs_.end() == option_defs_.find(space)) { diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index ad138d7460..2e8297b6da 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -46,7 +46,7 @@ using namespace isc::dhcp; using namespace isc::dhcp_ddns; using namespace isc::hooks; using namespace isc::stats; -using namespace isc::util::thread; +using namespace isc::util; namespace { /// Structure that holds registered hook indexes diff --git a/src/lib/dhcpsrv/alloc_engine.h b/src/lib/dhcpsrv/alloc_engine.h index 32c6be7fcb..1f829422fb 100644 --- a/src/lib/dhcpsrv/alloc_engine.h +++ b/src/lib/dhcpsrv/alloc_engine.h @@ -95,7 +95,7 @@ protected: const ClientClasses& client_classes, const DuidPtr& duid, const isc::asiolink::IOAddress& hint) { - std::lock_guard lock(&mutex_); + std::lock_guard lock(mutex_); return pickAddressInternal(subnet, client_classes, duid, hint); } diff --git a/src/lib/dhcpsrv/thread_pool.h b/src/lib/dhcpsrv/thread_pool.h index 8a2ab702b4..bcf98f8b9e 100644 --- a/src/lib/dhcpsrv/thread_pool.h +++ b/src/lib/dhcpsrv/thread_pool.h @@ -42,7 +42,7 @@ struct ThreadPoolQueue { } void add(WorkItem item) { - std::lock_guard lock(&mutex_); + std::lock_guard lock(mutex_); if (exit_) { return; } @@ -70,22 +70,22 @@ struct ThreadPoolQueue { } size_t count() { - std::lock_guard lock(&mutex_); + std::lock_guard lock(mutex_); return queue_.size(); } void removeAll() { - std::lock_guard lock(&mutex_); + std::lock_guard lock(mutex_); removeAllUnsafe(); } void create() { - std::lock_guard lock(&mutex_); + std::lock_guard lock(mutex_); exit_ = false; } void destroy() { - std::lock_guard lock(&mutex_); + std::lock_guard lock(mutex_); exit_ = true; // Notify get() so that it can exit. cv_.notify_all(); diff --git a/src/lib/dhcpsrv/thread_resource_mgr.h b/src/lib/dhcpsrv/thread_resource_mgr.h index baa2b1fea5..52685d5010 100644 --- a/src/lib/dhcpsrv/thread_resource_mgr.h +++ b/src/lib/dhcpsrv/thread_resource_mgr.h @@ -20,7 +20,7 @@ class ThreadResourceMgr { typedef boost::shared_ptr ResourcePtr; public: ResourcePtr resource() { - std::lock_guard lock(&mutex_); + std::lock_guard lock(mutex_); auto id = std::this_thread::get_id(); if (map_.find(id) != map_.end()) { return map_[id]; -- 2.47.2