xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
beast
core
CurrentThreadName.h
1
// Portions of this file are from JUCE (http://www.juce.com).
2
// Copyright (c) 2013 - Raw Material Software Ltd.
3
// Please visit http://www.juce.com
4
5
#pragma once
6
7
#include <boost/predef.h>
8
9
#include <
cstddef
>
10
#include <
string
>
11
#include <
string_view
>
12
13
namespace
beast
{
14
19
void
20
setCurrentThreadName
(std::string_view newThreadName);
21
22
#if BOOST_OS_LINUX
23
24
// On Linux, thread names are limited to 16 bytes including the null terminator.
25
// Maximum number of characters is therefore 15.
26
constexpr
std::size_t kMaxThreadNameLength = 15;
27
36
template
<std::
size_t
N>
37
void
38
setCurrentThreadName
(
char
const
(&newThreadName)[N])
39
{
40
static_assert
(N <= kMaxThreadNameLength + 1,
"Thread name cannot exceed 15 characters"
);
41
42
setCurrentThreadName
(std::string_view(newThreadName, N - 1));
43
}
44
#endif
45
55
std::string
56
getCurrentThreadName
();
57
58
}
// namespace beast
cstddef
beast
Definition
base_uint.h:697
beast::setCurrentThreadName
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
Definition
CurrentThreadName.cpp:115
beast::getCurrentThreadName
std::string getCurrentThreadName()
Returns the name of the caller thread.
Definition
CurrentThreadName.cpp:109
string
string_view
Generated by
1.17.0