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

@@ -15,8 +15,9 @@
# error "Manger task priority not specified in config.hpp"
#else
#include <list>
#include <set>
#include <list>
#include <memory>
#include <sta/tacos/thread.hpp>
namespace sta
@@ -39,7 +40,10 @@ namespace sta
return _instance;
}
void registerThread(TacosThread thread, std::list<uint16_t> states);
/**
*
*/
void registerThread(std::shared_ptr<TacosThread> thread, std::list<uint16_t> states);
void init() override;
@@ -73,7 +77,7 @@ namespace sta
void stopThreads(uint16_t state);
std::set<TacosThread> threads_[STA_TACOS_NUM_STATES];
std::set<std::shared_ptr<TacosThread>> threads_[STA_TACOS_NUM_STATES];
};
} // namespace tacos
} // namespace sta

View File

@@ -61,12 +61,12 @@ namespace sta
/**
* @brief This function is executed first when this thread is started.
*/
virtual void init();
virtual void init() = 0;
/**
* @brief The body of the thread's loop. Has to be implemented by the user.
*/
virtual void func();
virtual void func() = 0;
private: