aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/include
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-04-10 13:50:09 +0200
committerGitHub Enterprise <[email protected]>2024-04-10 13:50:09 +0200
commit1143af52ae1924b6e2cad347924bad578dda5391 (patch)
tree3caa74260f0ef753c4b0da4bf17153d0017e6b2c /src/zencore/include
parentchangelog (diff)
downloadzen-1143af52ae1924b6e2cad347924bad578dda5391.tar.xz
zen-1143af52ae1924b6e2cad347924bad578dda5391.zip
remote project store stats (#44)
* add remote oplog store statistics * block chunking when uploading oplog to zenserver (mirroring) * make sure we can move temporary dechunked file into cas store
Diffstat (limited to 'src/zencore/include')
-rw-r--r--src/zencore/include/zencore/thread.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/zencore/include/zencore/thread.h b/src/zencore/include/zencore/thread.h
index 2d0ef7396..bae630db9 100644
--- a/src/zencore/include/zencore/thread.h
+++ b/src/zencore/include/zencore/thread.h
@@ -206,6 +206,23 @@ private:
Event Complete;
};
+inline void
+SetAtomicMax(std::atomic_uint64_t& Max, uint64_t Value)
+{
+ while (true)
+ {
+ uint64_t CurrentMax = Max.load();
+ if (Value <= CurrentMax)
+ {
+ return;
+ }
+ if (Max.compare_exchange_strong(CurrentMax, Value))
+ {
+ return;
+ }
+ }
+}
+
ZENCORE_API int GetCurrentThreadId();
ZENCORE_API void Sleep(int ms);