mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 20:42:56 +01:00
42 lines
906 B
C++
42 lines
906 B
C++
#include "task_squad.h"
|
|
#include "runtime.h"
|
|
|
|
using namespace mx::tasking;
|
|
|
|
void TaskSquad::flush() noexcept
|
|
{
|
|
auto [first, last] = this->_remote_queue.pop();
|
|
if (first != nullptr)
|
|
{
|
|
if (last != nullptr)
|
|
{
|
|
this->_local_queue.push_back(first, last);
|
|
}
|
|
else
|
|
{
|
|
this->_local_queue.push_back(first);
|
|
}
|
|
}
|
|
}
|
|
|
|
TaskResult TaskSquadSpawnTask::execute(std::uint16_t worker_id)
|
|
{
|
|
this->_task_squad.flush();
|
|
|
|
/// Get all tasks.
|
|
auto [first, last] = this->_task_squad._local_queue.pop();
|
|
if (first != nullptr)
|
|
{
|
|
if (last != nullptr)
|
|
{
|
|
runtime::spawn(*first, *last, worker_id);
|
|
}
|
|
else
|
|
{
|
|
first->annotate(Annotation::execution_destination::local);
|
|
runtime::spawn(*first, worker_id);
|
|
}
|
|
}
|
|
|
|
return TaskResult::make_remove();
|
|
} |