Skip to content

Commit

Permalink
Modernize std::memory_order
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-babenko committed Apr 29, 2023
1 parent e93416e commit f37455f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions yt/yt/core/concurrency/new_fair_share_thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ class TTwoLevelFairShareQueue
threadState.AccountedAt = currentInstant;
}

auto request = threadState.Request.load(std::memory_order_acquire);
auto request = threadState.Request.load(std::memory_order::acquire);
if (request != ERequest::None) {
ServeEndExecute(&threadState, currentInstant);

Expand All @@ -824,7 +824,7 @@ class TTwoLevelFairShareQueue
threadRequests[threadIndex] = true;
threadIds[requestCount++] = threadIndex;
} else {
threadState.Request.store(ERequest::None, std::memory_order_release);
threadState.Request.store(ERequest::None, std::memory_order::release);
}
}
}
Expand Down Expand Up @@ -857,7 +857,7 @@ class TTwoLevelFairShareQueue
if (threadIndex != -1 && threadRequests[threadIndex]) {
ServeBeginExecute(&ThreadStates_[threadIndex], currentInstant, std::move(action));
threadRequests[threadIndex] = false;
ThreadStates_[threadIndex].Request.store(ERequest::None, std::memory_order_release);
ThreadStates_[threadIndex].Request.store(ERequest::None, std::memory_order::release);
} else {
OtherActions_[otherActionCount++] = std::move(action);
}
Expand All @@ -870,7 +870,7 @@ class TTwoLevelFairShareQueue
ServeBeginExecute(&ThreadStates_[threadIndex], currentInstant, std::move(OtherActions_[--otherActionCount]));
}

ThreadStates_[threadIndex].Request.store(ERequest::None, std::memory_order_release);
ThreadStates_[threadIndex].Request.store(ERequest::None, std::memory_order::release);
}
}

Expand Down Expand Up @@ -942,7 +942,7 @@ class TTwoLevelFairShareQueue
while (true) {
SpinLockPause();

if (request.load(std::memory_order_acquire) == ERequest::None) {
if (request.load(std::memory_order::acquire) == ERequest::None) {
return std::move(threadState.Action.Callback);
} else if (!MainLock_.IsLocked() && MainLock_.TryAcquire()) {
break;
Expand Down
4 changes: 2 additions & 2 deletions yt/yt/core/misc/hazard_ptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void THazardPointerManager::RetireHazardPointer(TPackedPtr packedPtr, THazardPtr
return;
}

int threadCount = ThreadCount_.load(std::memory_order_relaxed);
int threadCount = ThreadCount_.load(std::memory_order::relaxed);
while (std::ssize(threadState->RetireList) >= std::max(2 * threadCount, 1)) {
DoReclaimHazardPointers(threadState);
}
Expand All @@ -233,7 +233,7 @@ bool THazardPointerManager::TryReclaimHazardPointers()
YT_VERIFY(!threadState->Reclaiming);

bool hasNewPointers = DoReclaimHazardPointers(threadState);
int threadCount = ThreadCount_.load(std::memory_order_relaxed);
int threadCount = ThreadCount_.load(std::memory_order::relaxed);
return
hasNewPointers ||
std::ssize(threadState->RetireList) > threadCount;
Expand Down
2 changes: 1 addition & 1 deletion yt/yt/server/node/data_node/data_node_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ class TDataNodeService
NTracing::FlushCurrentTraceContextElapsedTime();
chunkReaderStatistics->RemoteCpuTime.fetch_add(
traceContext->GetElapsedTime().GetValue(),
std::memory_order_relaxed);
std::memory_order::relaxed);
}
ToProto(response->mutable_chunk_reader_statistics(), chunkReaderStatistics);

Expand Down

0 comments on commit f37455f

Please sign in to comment.