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

#include <util/system/compiler.h>

// Workaround for fiber (un)friendly TLS.
// Volatile qualifier prevents caching access to thread local variables.
#define YT_THREAD_LOCAL(...) thread_local __VA_ARGS__ volatile

namespace NYT {

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

template <class T>
Y_FORCE_INLINE T& GetTlsRef(volatile T& arg);

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

} // namespace NYT

#define TLS_INL_H_
#include "tls-inl.h"
#undef TLS_INL_H_