aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/misc/thread_name.h
blob: 96b8ed1995c3fde7593224dab6ad5dc3694d7fe5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once

#include <util/generic/string.h>

#include <array>

namespace NYT {

////////////////////////////////////////////////////////////////////////////////

struct TThreadName
{
    TThreadName() = default;
    TThreadName(const TString& name);

    TStringBuf ToStringBuf() const;

    static constexpr int BufferCapacity = 16; // including zero terminator
    std::array<char, BufferCapacity> Buffer{}; // zero-terminated
    int Length; // not including zero terminator
};

TThreadName GetCurrentThreadName();

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT