Fixed the addThread function

This commit is contained in:
dario 2024-01-02 01:40:09 +01:00
parent 9c167e2074
commit 74e1226998
2 changed files with 6 additions and 8 deletions

View File

@ -13,6 +13,7 @@
#include <sta/tacos/statemachine.hpp>
#include <initializer_list>
#include <type_traits>
namespace sta
@ -52,8 +53,11 @@ namespace sta
* @param states A list of states in which the thread should run.
* @param args The constructor arguments for the provided class.
*/
template<typename T>
void addThread(std::list<uint16_t> states, std::initializer_list<T> args);
template<typename T, typename ... Args>
void addThread(std::list<uint16_t> states, Args ... args)
{
Manager::instance()->registerThread(std::make_shared<T>(args...), states);
}
} // namespace tacos
}

View File

@ -26,12 +26,6 @@ namespace sta
{
Statemachine::instance()->requestTimedStateTransition(from, to, millis, lockout);
}
template<typename T>
void addThread(std::list<uint16_t> states, std::initializer_list<T> args)
{
Manager::instance()->registerThread(std::make_shared<T>(args), states);
}
} // namespace tacos
} // namespace sta