File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
ydb/library/actors/memory_log Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ unsigned TMemoryLog::GetSelfCpu() noexcept {
98
98
#endif
99
99
}
100
100
101
- TMemoryLog* TMemoryLog::MemLogBuffer = nullptr ;
101
+ std::atomic< TMemoryLog*> TMemoryLog::MemLogBuffer = nullptr ;
102
102
Y_POD_THREAD (TThread::TId)
103
103
TMemoryLog::LogThreadId;
104
104
char * TMemoryLog::LastMarkIsHere = nullptr ;
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class TMemoryLog {
42
42
static constexpr size_t LAST_MARK_SIZE = sizeof (DEFAULT_LAST_MARK);
43
43
44
44
inline static TMemoryLog* GetMemoryLogger () noexcept {
45
- return AtomicGet ( MemLogBuffer);
45
+ return MemLogBuffer. load (std::memory_order_acquire );
46
46
}
47
47
48
48
void * GetWriteBuffer (size_t amount) noexcept ;
@@ -63,11 +63,11 @@ class TMemoryLog {
63
63
size_t totalSize = DEFAULT_TOTAL_SIZE,
64
64
size_t grainSize = DEFAULT_GRAIN_SIZE)
65
65
Y_COLD {
66
- if (AtomicGet ( MemLogBuffer) != nullptr ) {
66
+ if (MemLogBuffer. load (std::memory_order_acquire ) != nullptr ) {
67
67
return ;
68
68
}
69
69
70
- AtomicSet ( MemLogBuffer, new TMemoryLog (totalSize, grainSize));
70
+ MemLogBuffer. store ( new TMemoryLog (totalSize, grainSize), std::memory_order_release );
71
71
}
72
72
73
73
static std::atomic<bool > PrintLastMark;
@@ -163,7 +163,7 @@ class TMemoryLog {
163
163
164
164
static unsigned GetSelfCpu () noexcept ;
165
165
166
- static TMemoryLog* MemLogBuffer;
166
+ static std::atomic< TMemoryLog*> MemLogBuffer;
167
167
static Y_POD_THREAD (TThread::TId) LogThreadId;
168
168
static char * LastMarkIsHere;
169
169
};
You can’t perform that action at this time.
0 commit comments