From: Razvan Becheriu Date: Mon, 28 Oct 2019 09:19:09 +0000 (+0200) Subject: [#885,!570] removed thread_local X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91f41d76289842658af672e59cb9f9afa31c8acd;p=thirdparty%2Fkea.git [#885,!570] removed thread_local --- diff --git a/src/lib/dhcpsrv/pgsql_host_data_source.cc b/src/lib/dhcpsrv/pgsql_host_data_source.cc index aa6d773024..b4d22499ec 100644 --- a/src/lib/dhcpsrv/pgsql_host_data_source.cc +++ b/src/lib/dhcpsrv/pgsql_host_data_source.cc @@ -1986,7 +1986,7 @@ PgSqlHostDataSourceImpl::delStatement(StatementIndex stindex, void PgSqlHostDataSourceImpl::addResv(const IPv6Resrv& resv, const HostID& id) { - thread_local std::shared_ptr host_ipv6_reservation_exchange( + std::shared_ptr host_ipv6_reservation_exchange( std::make_shared()); PsqlBindArrayPtr bind_array; @@ -2001,7 +2001,7 @@ PgSqlHostDataSourceImpl::addOption(const StatementIndex& stindex, const std::string& opt_space, const Optional&, const HostID& id) { - thread_local std::shared_ptr host_option_exchange( + std::shared_ptr host_option_exchange( std::make_shared()); PsqlBindArrayPtr bind_array; @@ -2140,7 +2140,7 @@ PgSqlHostDataSource::add(const HostPtr& host) { // If operating in read-only mode, throw exception. impl_->checkReadOnly(); - thread_local std::shared_ptr host_ipv4_exchange( + std::shared_ptr host_ipv4_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP4_ONLY)); // Initiate PostgreSQL transaction as we will have to make multiple queries @@ -2250,7 +2250,7 @@ ConstHostCollection PgSqlHostDataSource::getAll(const Host::IdentifierType& identifier_type, const uint8_t* identifier_begin, const size_t identifier_len) const { - thread_local std::shared_ptr host_ipv46_exchange( + std::shared_ptr host_ipv46_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP4_AND_DHCP6)); // Set up the WHERE clause value @@ -2270,7 +2270,7 @@ PgSqlHostDataSource::getAll(const Host::IdentifierType& identifier_type, ConstHostCollection PgSqlHostDataSource::getAll4(const SubnetID& subnet_id) const { - thread_local std::shared_ptr host_ipv4_exchange( + std::shared_ptr host_ipv4_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP4_ONLY)); // Set up the WHERE clause value @@ -2288,7 +2288,7 @@ PgSqlHostDataSource::getAll4(const SubnetID& subnet_id) const { ConstHostCollection PgSqlHostDataSource::getAll6(const SubnetID& subnet_id) const { - thread_local std::shared_ptr host_ipv6_exchange( + std::shared_ptr host_ipv6_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP6_ONLY)); // Set up the WHERE clause value @@ -2306,7 +2306,7 @@ PgSqlHostDataSource::getAll6(const SubnetID& subnet_id) const { ConstHostCollection PgSqlHostDataSource::getAllbyHostname(const std::string& hostname) const { - thread_local std::shared_ptr host_ipv46_exchange( + std::shared_ptr host_ipv46_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP4_AND_DHCP6)); // Set up the WHERE clause value @@ -2325,7 +2325,7 @@ PgSqlHostDataSource::getAllbyHostname(const std::string& hostname) const { ConstHostCollection PgSqlHostDataSource::getAllbyHostname4(const std::string& hostname, const SubnetID& subnet_id) const { - thread_local std::shared_ptr host_ipv4_exchange( + std::shared_ptr host_ipv4_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP4_ONLY)); // Set up the WHERE clause value @@ -2347,7 +2347,7 @@ PgSqlHostDataSource::getAllbyHostname4(const std::string& hostname, ConstHostCollection PgSqlHostDataSource::getAllbyHostname6(const std::string& hostname, const SubnetID& subnet_id) const { - thread_local std::shared_ptr host_ipv6_exchange( + std::shared_ptr host_ipv6_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP6_ONLY)); // Set up the WHERE clause value @@ -2371,7 +2371,7 @@ PgSqlHostDataSource::getPage4(const SubnetID& subnet_id, size_t& /*source_index*/, uint64_t lower_host_id, const HostPageSize& page_size) const { - thread_local std::shared_ptr host_ipv4_exchange( + std::shared_ptr host_ipv4_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP4_ONLY)); // Set up the WHERE clause value @@ -2400,7 +2400,7 @@ PgSqlHostDataSource::getPage6(const SubnetID& subnet_id, size_t& /*source_index*/, uint64_t lower_host_id, const HostPageSize& page_size) const { - thread_local std::shared_ptr host_ipv6_exchange( + std::shared_ptr host_ipv6_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP6_ONLY)); // Set up the WHERE clause value @@ -2426,7 +2426,7 @@ PgSqlHostDataSource::getPage6(const SubnetID& subnet_id, ConstHostCollection PgSqlHostDataSource::getAll4(const asiolink::IOAddress& address) const { - thread_local std::shared_ptr host_ipv4_exchange( + std::shared_ptr host_ipv4_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP4_ONLY)); // Set up the WHERE clause value @@ -2447,7 +2447,7 @@ PgSqlHostDataSource::get4(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type, const uint8_t* identifier_begin, const size_t identifier_len) const { - thread_local std::shared_ptr host_ipv4_exchange( + std::shared_ptr host_ipv4_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP4_ONLY)); return (impl_->getHost(subnet_id, identifier_type, identifier_begin, @@ -2464,7 +2464,7 @@ PgSqlHostDataSource::get4(const SubnetID& subnet_id, "wrong address type, address supplied is an IPv6 address"); } - thread_local std::shared_ptr host_ipv4_exchange( + std::shared_ptr host_ipv4_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP4_ONLY)); // Set up the WHERE clause value @@ -2494,7 +2494,7 @@ PgSqlHostDataSource::get6(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type, const uint8_t* identifier_begin, const size_t identifier_len) const { - thread_local std::shared_ptr host_ipv6_exchange( + std::shared_ptr host_ipv6_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP6_ONLY)); return (impl_->getHost(subnet_id, identifier_type, identifier_begin, @@ -2510,7 +2510,7 @@ PgSqlHostDataSource::get6(const asiolink::IOAddress& prefix, "wrong address type, address supplied is an IPv4 address"); } - thread_local std::shared_ptr host_ipv6_exchange( + std::shared_ptr host_ipv6_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP6_ONLY)); // Set up the WHERE clause value @@ -2543,7 +2543,7 @@ PgSqlHostDataSource::get6(const SubnetID& subnet_id, "wrong address type, address supplied is an IPv4 address"); } - thread_local std::shared_ptr host_ipv6_exchange( + std::shared_ptr host_ipv6_exchange( std::make_shared(PgSqlHostWithOptionsExchange::DHCP6_ONLY)); // Set up the WHERE clause value diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.cc b/src/lib/dhcpsrv/pgsql_lease_mgr.cc index 83ce3c21d5..a4691ffad3 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.cc +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.cc @@ -1182,7 +1182,7 @@ PgSqlLeaseMgr::addLeaseCommon(StatementIndex stindex, bool PgSqlLeaseMgr::addLease(const Lease4Ptr& lease) { - thread_local std::shared_ptr exchange4( + std::shared_ptr exchange4( std::make_shared()); LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, @@ -1195,7 +1195,7 @@ PgSqlLeaseMgr::addLease(const Lease4Ptr& lease) { bool PgSqlLeaseMgr::addLease(const Lease6Ptr& lease) { - thread_local std::shared_ptr exchange6( + std::shared_ptr exchange6( std::make_shared()); LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, @@ -1235,7 +1235,7 @@ void PgSqlLeaseMgr::getLeaseCollection(StatementIndex stindex, void PgSqlLeaseMgr::getLeaseCollection(StatementIndex stindex, db::PsqlBindArray& bind_array, Lease4Collection& result) const { - thread_local std::shared_ptr exchange4( + std::shared_ptr exchange4( std::make_shared()); getLeaseCollection(stindex, bind_array, exchange4, result); @@ -1244,7 +1244,7 @@ PgSqlLeaseMgr::getLeaseCollection(StatementIndex stindex, db::PsqlBindArray& bin void PgSqlLeaseMgr::getLeaseCollection(StatementIndex stindex, db::PsqlBindArray& bind_array, Lease6Collection& result) const { - thread_local std::shared_ptr exchange6( + std::shared_ptr exchange6( std::make_shared()); getLeaseCollection(stindex, bind_array, exchange6, result); @@ -1253,7 +1253,7 @@ PgSqlLeaseMgr::getLeaseCollection(StatementIndex stindex, db::PsqlBindArray& bin void PgSqlLeaseMgr::getLease(StatementIndex stindex, PsqlBindArray& bind_array, Lease4Ptr& result) const { - thread_local std::shared_ptr exchange4( + std::shared_ptr exchange4( std::make_shared()); // Create appropriate collection object and get all leases matching @@ -1275,7 +1275,7 @@ PgSqlLeaseMgr::getLease(StatementIndex stindex, PsqlBindArray& bind_array, void PgSqlLeaseMgr::getLease(StatementIndex stindex, PsqlBindArray& bind_array, Lease6Ptr& result) const { - thread_local std::shared_ptr exchange6( + std::shared_ptr exchange6( std::make_shared()); // Create appropriate collection object and get all leases matching @@ -1767,7 +1767,7 @@ PgSqlLeaseMgr::updateLeaseCommon(StatementIndex stindex, void PgSqlLeaseMgr::updateLease4(const Lease4Ptr& lease) { - thread_local std::shared_ptr exchange4( + std::shared_ptr exchange4( std::make_shared()); const StatementIndex stindex = UPDATE_LEASE4; @@ -1789,7 +1789,7 @@ PgSqlLeaseMgr::updateLease4(const Lease4Ptr& lease) { void PgSqlLeaseMgr::updateLease6(const Lease6Ptr& lease) { - thread_local std::shared_ptr exchange6( + std::shared_ptr exchange6( std::make_shared()); const StatementIndex stindex = UPDATE_LEASE6;