44 lines
787 B
C++
44 lines
787 B
C++
/*
|
|
* threads_actor_thread.hpp
|
|
*
|
|
* Created on: Sep 19, 2021
|
|
* Author: erki
|
|
*/
|
|
|
|
#ifndef THREADS_ACTOR_THREAD_HPP_
|
|
#define THREADS_ACTOR_THREAD_HPP_
|
|
|
|
#include <threads_primitivethread.hpp>
|
|
|
|
namespace Threads
|
|
{
|
|
|
|
class IActor;
|
|
|
|
class ActorThread : PrimitiveThread
|
|
{
|
|
public:
|
|
ActorThread() = delete;
|
|
ActorThread(const ActorThread&) = delete;
|
|
ActorThread(ActorThread&&) = delete;
|
|
|
|
ActorThread(const char* name, const osPriority_t priority, const std::uint32_t stack_size)
|
|
: PrimitiveThread(&ActorThread::run_, this, name, priority, stack_size)
|
|
{ }
|
|
|
|
private:
|
|
friend class IActor;
|
|
|
|
static void run_(void* data);
|
|
|
|
void acceptActor_(IActor* actor);
|
|
void removeActor_(IActor* actor);
|
|
|
|
std::array<IActor*, 32> actors_;
|
|
};
|
|
|
|
}
|
|
|
|
|
|
#endif /* THREADS_ACTOR_THREAD_HPP_ */
|