aboutsummaryrefslogtreecommitdiff
path: root/zenstore/include
diff options
context:
space:
mode:
Diffstat (limited to 'zenstore/include')
-rw-r--r--zenstore/include/zenstore/gc.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/zenstore/include/zenstore/gc.h b/zenstore/include/zenstore/gc.h
index 560642803..8efe933a0 100644
--- a/zenstore/include/zenstore/gc.h
+++ b/zenstore/include/zenstore/gc.h
@@ -5,8 +5,9 @@
#include <zencore/iohash.h>
#include <zencore/thread.h>
-#include <span>
+#include <atomic>
#include <functional>
+#include <span>
#define ZEN_USE_REF_TRACKING 0 // This is not currently functional
@@ -107,4 +108,23 @@ private:
CidStore* m_CidStore;
};
+enum class GcStatus : uint32_t
+{
+ kIdle,
+ kRunning
+};
+
+class Gc
+{
+public:
+ bool Trigger();
+ CasGc& Cas() { return m_CasGc; }
+ GcStatus Status() const { return static_cast<GcStatus>(m_Status.load()); }
+
+private:
+ CasGc m_CasGc;
+ std::jthread m_GcThread;
+ std::atomic_uint32_t m_Status;
+};
+
} // namespace zen