/Users/eugenesiegel/btc/bitcoin/src/util/thread.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2021-2022 The Bitcoin Core developers |
2 | | // Distributed under the MIT software license, see the accompanying |
3 | | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | | |
5 | | #include <util/thread.h> |
6 | | |
7 | | #include <logging.h> |
8 | | #include <util/exception.h> |
9 | | #include <util/threadnames.h> |
10 | | |
11 | | #include <exception> |
12 | | #include <functional> |
13 | | #include <string> |
14 | | #include <utility> |
15 | | |
16 | | void util::TraceThread(std::string_view thread_name, std::function<void()> thread_func) |
17 | 38.8k | { |
18 | 38.8k | util::ThreadRename(std::string{thread_name}); |
19 | 38.8k | try { |
20 | 38.8k | LogInfo("%s thread start", thread_name); Line | Count | Source | 356 | 38.8k | #define LogInfo(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Info, /*should_ratelimit=*/true, __VA_ARGS__) Line | Count | Source | 350 | 38.8k | #define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(std::source_location::current(), category, level, should_ratelimit, __VA_ARGS__) |
|
|
21 | 38.8k | thread_func(); |
22 | 38.8k | LogInfo("%s thread exit", thread_name); Line | Count | Source | 356 | 38.8k | #define LogInfo(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Info, /*should_ratelimit=*/true, __VA_ARGS__) Line | Count | Source | 350 | 38.8k | #define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(std::source_location::current(), category, level, should_ratelimit, __VA_ARGS__) |
|
|
23 | 38.8k | } catch (const std::exception& e) { |
24 | 0 | PrintExceptionContinue(&e, thread_name); |
25 | 0 | throw; |
26 | 0 | } catch (...) { |
27 | 0 | PrintExceptionContinue(nullptr, thread_name); |
28 | 0 | throw; |
29 | 0 | } |
30 | 38.8k | } |