Changed registerThread to accept shared_ptrs to fix some issues with polymorphism.

This commit is contained in:
dario
2023-09-29 15:12:44 +02:00
parent 54b2e4e9cd
commit 1a9a96503e
8 changed files with 28 additions and 35 deletions

View File

@@ -12,6 +12,8 @@
#include <sta/tacos/manager.hpp>
#include <tasks/dummy.hpp>
#include <memory>
namespace sta
{
@@ -26,9 +28,9 @@ namespace sta
{
STA_DEBUG_PRINTLN("Starting manager task!");
// Manager::instance()->registerThread(demo::DummyTask("A"), {0, 1});
// Manager::instance()->registerThread(demo::DummyTask("B"), {1, 2});
// Manager::instance()->registerThread(demo::DummyTask("C"), {2, 3});
Manager::instance()->registerThread(std::make_unique<demo::DummyTask>("A"), {0, 1});
Manager::instance()->registerThread(std::make_unique<demo::DummyTask>("B"), {0, 2});
Manager::instance()->registerThread(std::make_unique<demo::DummyTask>("C"), {0, 3});
}
} // namespace tacos
} // namespace sta

View File

@@ -23,13 +23,15 @@ namespace demo
void DummyTask::init()
{
STA_DEBUG_PRINTLN("Initialized dummy task!");
}
void DummyTask::func()
{
STA_DEBUG_PRINT("Executing ");
STA_DEBUG_PRINTLN(this->getName());
// STA_DEBUG_PRINT("Executing ");
// STA_DEBUG_PRINTLN(this->getName());
osDelay(1000);
}
} // namespace demo