From 30e44482152488a78f2c495798a75e6f553dc0c8 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 13 Apr 2021 20:44:46 +0300 Subject: refactor: Make TraceThread a non-template free function Also it is moved into its own module. --- src/index/base.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/index') diff --git a/src/index/base.cpp b/src/index/base.cpp index 9e637c9c6f..88d5fbee1d 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include // For g_chainman #include @@ -349,7 +349,7 @@ void BaseIndex::Start() return; } - m_thread_sync = std::thread(&TraceThread>, GetName(), + m_thread_sync = std::thread(&util::TraceThread, GetName(), std::bind(&BaseIndex::ThreadSync, this)); } -- cgit v1.2.3 From 792be53d3e9e366b9f6aeee7a1eeb912fa28062e Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 13 Apr 2021 21:22:52 +0300 Subject: refactor: Replace std::bind with lambdas Lambdas are shorter and more readable. Changes are limited to std::thread ctor calls only. --- src/index/base.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/index') diff --git a/src/index/base.cpp b/src/index/base.cpp index 88d5fbee1d..fc25514f1a 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -349,8 +349,7 @@ void BaseIndex::Start() return; } - m_thread_sync = std::thread(&util::TraceThread, GetName(), - std::bind(&BaseIndex::ThreadSync, this)); + m_thread_sync = std::thread(&util::TraceThread, GetName(), [this] { ThreadSync(); }); } void BaseIndex::Stop() -- cgit v1.2.3