mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-08-02 16:51:53 +00:00
Merge pull request 'Added return value to addThread' (#22) from thread-memory into main
Reviewed-on: https://git.intern.spaceteamaachen.de/ALPAKA/TACOS/pulls/22 Reviewed-by: carlwachter <carlwachter@noreply.git.intern.spaceteamaachen.de>
This commit is contained in:
commit
93a4112f59
@ -68,9 +68,13 @@ namespace sta
|
|||||||
* @ingroup tacos_api
|
* @ingroup tacos_api
|
||||||
*/
|
*/
|
||||||
template<typename T, typename ... Args>
|
template<typename T, typename ... Args>
|
||||||
void addThread(std::list<uint16_t> states, Args ... args)
|
std::shared_ptr<T> addThread(std::list<uint16_t> states, Args ... args)
|
||||||
{
|
{
|
||||||
Manager::instance()->registerThread(std::make_shared<T>(args...), states);
|
std::shared_ptr<T> thread_ptr = std::make_shared<T>(args...);
|
||||||
|
|
||||||
|
Manager::instance()->registerThread(thread_ptr, states);
|
||||||
|
|
||||||
|
return thread_ptr;
|
||||||
}
|
}
|
||||||
} // namespace tacos
|
} // namespace tacos
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,13 @@ namespace sta
|
|||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Create a new thread with the given name and priority.
|
* @brief Create a new thread with the given name and priority.
|
||||||
|
*
|
||||||
|
* @param name The thread's name. This is used for debugging.
|
||||||
|
* @param prio The thread's priority. Generally, this should be lower than the manager and statemachine priority.
|
||||||
|
* @param stack_size The stack size for the task. The default is 0, i.e. the stack size specified in the FreeRTOS settings.
|
||||||
|
* @param cb_size The control block size for the task. The default is 0, i.e. the size specified in the FreeRTOS settings.
|
||||||
*/
|
*/
|
||||||
TacosThread(const char* name, osPriority_t prio);
|
TacosThread(const char* name, osPriority_t prio, uint32_t stack_size = 0, uint32_t cb_size = 0);
|
||||||
|
|
||||||
TacosThread();
|
|
||||||
|
|
||||||
virtual ~TacosThread();
|
virtual ~TacosThread();
|
||||||
|
|
||||||
|
@ -19,19 +19,15 @@ namespace sta
|
|||||||
{
|
{
|
||||||
namespace tacos
|
namespace tacos
|
||||||
{
|
{
|
||||||
TacosThread::TacosThread(const char* name, osPriority_t prio)
|
TacosThread::TacosThread(const char* name, osPriority_t prio, uint32_t stack_size /* = 0 */, uint32_t cb_size /* = 0 */)
|
||||||
: RtosThread(RtosHandle<osThreadId_t>(Handle::Deferred(&instance_))),
|
: RtosThread(RtosHandle<osThreadId_t>(Handle::Deferred(&instance_))),
|
||||||
instance_{ NULL },
|
instance_{ NULL },
|
||||||
attribs_{ .name = name, .priority = prio },
|
attribs_{ .name=name, .cb_size=cb_size, .stack_size=stack_size, .priority=prio },
|
||||||
running_{false}
|
running_{false}
|
||||||
{}
|
{
|
||||||
|
STA_ASSERT(stack_size >= 0);
|
||||||
TacosThread::TacosThread()
|
STA_ASSERT(cb_size >= 0);
|
||||||
: RtosThread(RtosHandle<osThreadId_t>(Handle::Deferred(&instance_))),
|
}
|
||||||
instance_{ NULL },
|
|
||||||
attribs_{ },
|
|
||||||
running_{false}
|
|
||||||
{}
|
|
||||||
|
|
||||||
void TacosThread::entry_point(void* arg)
|
void TacosThread::entry_point(void* arg)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user