diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-04-13 20:44:46 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-04-25 12:28:44 +0300 |
commit | 30e44482152488a78f2c495798a75e6f553dc0c8 (patch) | |
tree | 3a23901c0ed8c22ebad5cf8451be272f72fd2989 /src/net.cpp | |
parent | a1f0b8b62eb851c837a3618583b7c2fd4d12006c (diff) |
refactor: Make TraceThread a non-template free function
Also it is moved into its own module.
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/net.cpp b/src/net.cpp index ae38acdc3c..0845aeebc0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -23,6 +23,7 @@ #include <scheduler.h> #include <util/sock.h> #include <util/strencodings.h> +#include <util/thread.h> #include <util/translation.h> #ifdef WIN32 @@ -2527,15 +2528,15 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions) } // Send and receive from sockets, accept connections - threadSocketHandler = std::thread(&TraceThread<std::function<void()> >, "net", std::function<void()>(std::bind(&CConnman::ThreadSocketHandler, this))); + threadSocketHandler = std::thread(&util::TraceThread, "net", std::bind(&CConnman::ThreadSocketHandler, this)); if (!gArgs.GetBoolArg("-dnsseed", DEFAULT_DNSSEED)) LogPrintf("DNS seeding disabled\n"); else - threadDNSAddressSeed = std::thread(&TraceThread<std::function<void()> >, "dnsseed", std::function<void()>(std::bind(&CConnman::ThreadDNSAddressSeed, this))); + threadDNSAddressSeed = std::thread(&util::TraceThread, "dnsseed", std::bind(&CConnman::ThreadDNSAddressSeed, this)); // Initiate manual connections - threadOpenAddedConnections = std::thread(&TraceThread<std::function<void()> >, "addcon", std::function<void()>(std::bind(&CConnman::ThreadOpenAddedConnections, this))); + threadOpenAddedConnections = std::thread(&util::TraceThread, "addcon", std::bind(&CConnman::ThreadOpenAddedConnections, this)); if (connOptions.m_use_addrman_outgoing && !connOptions.m_specified_outgoing.empty()) { if (clientInterface) { @@ -2546,14 +2547,14 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions) return false; } if (connOptions.m_use_addrman_outgoing || !connOptions.m_specified_outgoing.empty()) - threadOpenConnections = std::thread(&TraceThread<std::function<void()> >, "opencon", std::function<void()>(std::bind(&CConnman::ThreadOpenConnections, this, connOptions.m_specified_outgoing))); + threadOpenConnections = std::thread(&util::TraceThread, "opencon", std::bind(&CConnman::ThreadOpenConnections, this, connOptions.m_specified_outgoing)); // Process messages - threadMessageHandler = std::thread(&TraceThread<std::function<void()> >, "msghand", std::function<void()>(std::bind(&CConnman::ThreadMessageHandler, this))); + threadMessageHandler = std::thread(&util::TraceThread, "msghand", std::bind(&CConnman::ThreadMessageHandler, this)); if (connOptions.m_i2p_accept_incoming && m_i2p_sam_session.get() != nullptr) { threadI2PAcceptIncoming = - std::thread(&TraceThread<std::function<void()>>, "i2paccept", + std::thread(&util::TraceThread, "i2paccept", std::function<void()>(std::bind(&CConnman::ThreadI2PAcceptIncoming, this))); } |