mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
TDB2
- Commented and reorganized for threading.
This commit is contained in:
parent
aa8cd54142
commit
104aeb3905
2 changed files with 12 additions and 4 deletions
|
@ -275,7 +275,7 @@ int Context::initialize (int argc, const char** argv)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// [8] Run on.launch hooks.
|
// [8] Initialize hooks.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
14
src/TDB2.cpp
14
src/TDB2.cpp
|
@ -1179,18 +1179,21 @@ int TDB2::gc ()
|
||||||
// Allowed as an override, but not recommended.
|
// Allowed as an override, but not recommended.
|
||||||
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 ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue