Coverage Report

Created: 2026-04-29 19:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/tmp/bitcoin/src/util/thread.cpp
Line
Count
Source
1
// Copyright (c) 2021-present 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 <util/exception.h>
8
#include <util/log.h>
9
#include <util/threadnames.h>
10
11
#include <exception>
12
#include <functional>
13
#include <string>
14
15
void util::TraceThread(std::string_view thread_name, std::function<void()> thread_func)
16
7.67k
{
17
7.67k
    util::ThreadRename(std::string{thread_name});
18
7.67k
    try {
19
7.67k
        LogInfo("%s thread start", thread_name);
20
7.67k
        thread_func();
21
7.67k
        LogInfo("%s thread exit", thread_name);
22
7.67k
    } catch (const std::exception& e) {
23
0
        PrintExceptionContinue(&e, thread_name);
24
0
        throw;
25
0
    } catch (...) {
26
0
        PrintExceptionContinue(nullptr, thread_name);
27
0
        throw;
28
0
    }
29
7.67k
}