- Commented and reorganized for threading.
This commit is contained in:
Paul Beckingham 2015-03-02 09:33:57 -05:00
parent aa8cd54142
commit 104aeb3905
2 changed files with 12 additions and 4 deletions

View file

@ -275,7 +275,7 @@ int Context::initialize (int argc, const char** argv)
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
// [8] Run on.launch hooks. // [8] Initialize hooks.
// //
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////

View file

@ -1180,17 +1180,20 @@ int TDB2::gc ()
if (context.config.getBoolean ("gc")) if (context.config.getBoolean ("gc"))
{ {
std::vector <Task> pending_tasks = pending.get_tasks (); std::vector <Task> pending_tasks = pending.get_tasks ();
// TODO Thread.
std::vector <Task> completed_tasks = completed.get_tasks (); std::vector <Task> 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 pending_changes = false;
bool completed_changes = false; bool completed_changes = false;
std::vector <Task> pending_tasks_after; std::vector <Task> pending_tasks_after;
std::vector <Task> completed_tasks_after; std::vector <Task> completed_tasks_after;
// Reduce unnecessary allocation/copies. // Reduce unnecessary allocation/copies.
pending_tasks_after.reserve (pending_tasks.size ()); 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 // Scan all pending tasks, looking for any that need to be relocated to
// completed, or need to be 'woken'. // 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 // Scan all completed tasks, looking for any that need to be relocated to
// pending. // pending.
for (task = completed_tasks.begin (); for (task = completed_tasks.begin ();