skullc-peripherals/Threads/Inc/threads_thread.hpp
Erki ea474dd915
All checks were successful
continuous-integration/drone/push Build is passing
Threads: Add initial Actor implementation, rework primitivethread a bit.
2021-06-20 21:14:30 +03:00

39 lines
784 B
C++

/*
* tasks_task.hpp
*
* Created on: Mar 18, 2021
* Author: erki
*/
#ifndef SKULLC_THREADS_THREAD_HPP_
#define SKULLC_THREADS_THREAD_HPP_
#include "threads_primitivethread.hpp"
namespace Threads
{
template<typename CRTP>
class Thread : public PrimitiveThread
{
public:
Thread(const char* name, const osPriority_t priority, const std::uint32_t stack_size)
: PrimitiveThread([](void* d) {
CRTP* dd = static_cast<CRTP*>(d);
(*dd)();
},
this, name, priority, stack_size)
{}
Thread() = delete;
Thread(const Thread&) = delete;
Thread(Thread&&) = delete;
Thread& operator=(const Thread&) = delete;
Thread& operator=(Thread&&) = delete;
};
}// namespace Threads
#endif /* SKULLC_THREADS_THREAD_HPP_ */