Bitcoin Core  27.99.0
P2P Digital Currency
Classes | Enumerations | Functions
util Namespace Reference

Classes

struct  Overloaded
 Overloaded helper for std::visit. More...
 
struct  Error
 
class  Result
 
class  SignalInterrupt
 Helper class that manages an interrupt flag, and allows a thread or signal to interrupt another thread. More...
 
class  TaskRunnerInterface
 
class  ImmediateTaskRunner
 

Enumerations

enum class  LockResult { Success , ErrorWrite , ErrorLock }
 

Functions

void Xor (Span< std::byte > write, Span< const std::byte > key, size_t key_offset=0)
 
template<typename T >
T * AnyPtr (const std::any &any) noexcept
 Helper function to access the contained object of a std::any instance. More...
 
LockResult LockDirectory (const fs::path &directory, const fs::path &lockfile_name, bool probe_only)
 
template<typename Tdst , typename Tsrc >
void insert (Tdst &dst, const Tsrc &src)
 Simplification of std insertion. More...
 
template<typename TsetT , typename Tsrc >
void insert (std::set< TsetT > &dst, const Tsrc &src)
 
template<class... Ts>
 Overloaded (Ts...) -> Overloaded< Ts... >
 Explicit deduction guide (not needed after clang-17) More...
 
template<typename T >
bilingual_str ErrorString (const Result< T > &result)
 
void TraceThread (std::string_view thread_name, std::function< void()> thread_func)
 A wrapper for do-something-once thread functions. More...
 
void ThreadRename (const std::string &)
 Rename a thread both in terms of an internal (in-memory) name as well as its system thread name. More...
 
void ThreadSetInternalName (const std::string &)
 Set the internal (in-memory) name of the current thread only. More...
 
std::string ThreadGetInternalName ()
 Get the thread's internal (in-memory) name; used e.g. More...
 

Enumeration Type Documentation

◆ LockResult

enum util::LockResult
strong
Enumerator
Success 
ErrorWrite 
ErrorLock 

Definition at line 39 of file fs_helpers.h.

Function Documentation

◆ AnyPtr()

template<typename T >
T* util::AnyPtr ( const std::any &  any)
noexcept

Helper function to access the contained object of a std::any instance.

Returns a pointer to the object if passed instance has a value and the type matches, nullptr otherwise.

Definition at line 18 of file any.h.

◆ ErrorString()

template<typename T >
bilingual_str util::ErrorString ( const Result< T > &  result)

Definition at line 93 of file result.h.

Here is the caller graph for this function:

◆ insert() [1/2]

template<typename TsetT , typename Tsrc >
void util::insert ( std::set< TsetT > &  dst,
const Tsrc &  src 
)
inline

Definition at line 18 of file insert.h.

◆ insert() [2/2]

template<typename Tdst , typename Tsrc >
void util::insert ( Tdst &  dst,
const Tsrc &  src 
)
inline

Simplification of std insertion.

Definition at line 14 of file insert.h.

Here is the caller graph for this function:

◆ LockDirectory()

LockResult util::LockDirectory ( const fs::path directory,
const fs::path lockfile_name,
bool  probe_only 
)

Definition at line 52 of file fs_helpers.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Overloaded()

template<class... Ts>
util::Overloaded ( Ts...  ) -> Overloaded< Ts... >

Explicit deduction guide (not needed after clang-17)

◆ ThreadGetInternalName()

std::string util::ThreadGetInternalName ( )

Get the thread's internal (in-memory) name; used e.g.

for identification in logging.

Definition at line 47 of file threadnames.cpp.

Here is the caller graph for this function:

◆ ThreadRename()

void util::ThreadRename ( const std::string &  name)

Rename a thread both in terms of an internal (in-memory) name as well as its system thread name.

Note
Do not call this for the main thread, as this will interfere with UNIX utilities such as top and killall. Use ThreadSetInternalName instead.

Definition at line 57 of file threadnames.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ThreadSetInternalName()

void util::ThreadSetInternalName ( const std::string &  name)

Set the internal (in-memory) name of the current thread only.

Definition at line 63 of file threadnames.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TraceThread()

void util::TraceThread ( std::string_view  thread_name,
std::function< void()>  thread_func 
)

A wrapper for do-something-once thread functions.

Definition at line 16 of file thread.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Xor()

void util::Xor ( Span< std::byte >  write,
Span< const std::byte >  key,
size_t  key_offset = 0 
)
inline

Definition at line 28 of file streams.h.

Here is the call graph for this function:
Here is the caller graph for this function: