rippled
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 <
string
>
10
#include <
string_view
>
11
12
namespace
beast
{
13
17
void
18
setCurrentThreadName
(
std::string_view
newThreadName);
19
20
#if BOOST_OS_LINUX
21
22
// On Linux, thread names are limited to 16 bytes including the null terminator.
23
// Maximum number of characters is therefore 15.
24
constexpr
std::size_t
maxThreadNameLength = 15;
25
33
template
<std::
size_t
N>
34
void
35
setCurrentThreadName
(
char
const
(&newThreadName)[N])
36
{
37
static_assert
(N <= maxThreadNameLength + 1,
"Thread name cannot exceed 15 characters"
);
38
39
setCurrentThreadName
(
std::string_view
(newThreadName, N - 1));
40
}
41
#endif
42
51
std::string
52
getCurrentThreadName
();
53
54
}
// namespace beast
std::string
std::string_view
beast
Definition
base_uint.h:637
beast::setCurrentThreadName
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
Definition
CurrentThreadName.cpp:117
beast::getCurrentThreadName
std::string getCurrentThreadName()
Returns the name of the caller thread.
Definition
CurrentThreadName.cpp:111
std::size_t
string
string_view
Generated by
1.9.8