From 104aeb390591546b27c0144a771dee7b2357332f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 2 Mar 2015 09:33:57 -0500 Subject: [PATCH] TDB2 - Commented and reorganized for threading. --- src/Context.cpp | 2 +- src/TDB2.cpp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index 4d0e6bc0b..e7adc9b89 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -275,7 +275,7 @@ int Context::initialize (int argc, const char** argv) //////////////////////////////////////////////////////////////////////////// // - // [8] Run on.launch hooks. + // [8] Initialize hooks. // //////////////////////////////////////////////////////////////////////////// diff --git a/src/TDB2.cpp b/src/TDB2.cpp index d7d17d589..555f32150 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -1179,18 +1179,21 @@ int TDB2::gc () // Allowed as an override, but not recommended. if (context.config.getBoolean ("gc")) { - std::vector pending_tasks = pending.get_tasks (); + std::vector pending_tasks = pending.get_tasks (); + + // TODO Thread. std::vector completed_tasks = completed.get_tasks (); + // TODO Assume pending < completed, therefore there is room here to process + // data before joining with the completed.data thread. + bool pending_changes = false; bool completed_changes = false; - std::vector pending_tasks_after; std::vector completed_tasks_after; // Reduce unnecessary allocation/copies. pending_tasks_after.reserve (pending_tasks.size ()); - completed_tasks_after.reserve (completed_tasks.size ()); // Scan all pending tasks, looking for any that need to be relocated to // completed, or need to be 'woken'. @@ -1227,6 +1230,11 @@ int TDB2::gc () } } + // TODO Join completed.data thread. + + // Reduce unnecessary allocation/copies. + completed_tasks_after.reserve (completed_tasks.size ()); + // Scan all completed tasks, looking for any that need to be relocated to // pending. for (task = completed_tasks.begin ();