Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
thread.cpp
Go to the documentation of this file.
1// Copyright (c) 2021 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
14 std::function<void()> thread_func) {
16 try {
17 LogPrintf("%s thread start\n", thread_name);
19 LogPrintf("%s thread exit\n", thread_name);
20 } catch (const std::exception &e) {
22 throw;
23 } catch (...) {
25 throw;
26 }
27}
void PrintExceptionContinue(const std::exception *pex, const char *pszThread)
Definition exception.cpp:38
#define LogPrintf(...)
Definition logging.h:207
void TraceThread(const char *thread_name, std::function< void()> thread_func)
A wrapper for do-something-once thread functions.
Definition thread.cpp:13
void ThreadRename(std::string &&)
Rename a thread both in terms of an internal (in-memory) name as well as its system thread name.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85