test: added TaskSchedulerTestSuite

This commit is contained in:
Eberhard Graether
2015-04-24 17:39:32 +02:00
parent abd29b1060
commit d1db054d98
5 changed files with 349 additions and 3 deletions
@@ -43,11 +43,11 @@ void TaskGroupSequential::exit()
void TaskGroupSequential::interrupt()
{
if (m_taskIndex > 0 && size_t(m_taskIndex) < m_tasks.size())
if (m_taskIndex >= 0 && size_t(m_taskIndex) < m_tasks.size())
{
for (int i = m_taskIndex; i >= 0; i--)
{
m_tasks[m_taskIndex]->process(true);
m_tasks[i]->process(true);
}
}
}
@@ -56,6 +56,6 @@ void TaskGroupSequential::revert()
{
for (int i = m_tasks.size() - 1; i >= 0; i--)
{
m_tasks[m_taskIndex]->process(true);
m_tasks[i]->process(true);
}
}
@@ -112,6 +112,12 @@ bool TaskScheduler::loopIsRunning() const
return m_loopIsRunning;
}
bool TaskScheduler::hasTasksQueued() const
{
std::lock_guard<std::mutex> lock(m_tasksMutex);
return m_tasks.size();
}
std::shared_ptr<TaskScheduler> TaskScheduler::s_instance;
TaskScheduler::TaskScheduler()
@@ -23,6 +23,7 @@ public:
void stopSchedulerLoop();
bool loopIsRunning() const;
bool hasTasksQueued() const;
private:
static std::shared_ptr<TaskScheduler> s_instance;