aboutsummaryrefslogtreecommitdiff
path: root/zenstore
diff options
context:
space:
mode:
Diffstat (limited to 'zenstore')
-rw-r--r--zenstore/gc.cpp17
-rw-r--r--zenstore/include/zenstore/gc.h2
2 files changed, 18 insertions, 1 deletions
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index cb03f72ff..3395761d6 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -110,6 +110,23 @@ CasGc::RemoveGcStorage(GcStorage* Storage)
void
CasGc::CollectGarbage()
{
+ RwLock::SharedLockScope _(m_Lock);
+
+ // First gather reference set
+
+ GcContext GcCtx;
+
+ for (GcContributor* Contributor : m_GcContribs)
+ {
+ Contributor->GatherReferences(GcCtx);
+ }
+
+ // Then trim storage
+
+ for (GcStorage* Storage : m_GcStorage)
+ {
+ Storage->CollectGarbage(GcCtx);
+ }
}
void
diff --git a/zenstore/include/zenstore/gc.h b/zenstore/include/zenstore/gc.h
index ef62158ce..d3092d91c 100644
--- a/zenstore/include/zenstore/gc.h
+++ b/zenstore/include/zenstore/gc.h
@@ -65,7 +65,7 @@ public:
GcStorage(CasGc& Gc);
~GcStorage();
- virtual void CollectGarbage(GcContext& GcCtrx) = 0;
+ virtual void CollectGarbage(GcContext& GcCtx) = 0;
private:
CasGc& m_Gc;