8#ifndef HPP_AWORX_ALIB_THREADS_MODEL_MTHREAD
9#define HPP_AWORX_ALIB_THREADS_MODEL_MTHREAD
14#if !defined(HPP_ALIB_THREADS_SLEEPER)
18#if !defined (HPP_ALIB_THREADS_THREADLOCK)
22#if !defined (HPP_AWORX_ALIB_THREADS_MODEL_TRIGGERED)
26#if !defined (HPP_ALIB_BOXING_ENUM)
35namespace alib {
namespace threads::model {
46 friend class ThreadManager;
49 enum class InternalCommands
62 friend class ThreadManager;
73 Command(
alib::Enum pCmd,
int pPriority, Box pData, Box pData2=
nullptr)
84 Command(
const Command& ) =
default;
91 bool operator<=(
const Command& rhs )
const {
return (priority<= rhs.priority); }
96 bool operator> (
const Command& rhs )
const {
return ( priority < rhs.priority); }
106 std::list<Command> pipe;
114 CmdPipe() : usageCounter(0) {}
121 void Push(
alib::Enum cmd,
int priority, Box data=
nullptr, Box data2=
nullptr);
124 int PeekSize() {
return static_cast<int>( pipe.size()); }
125 Command PeekCmd(
int n);
137 virtual ~MThread()
override;
141 bool IsStopped() {
return stoppedFlag; }
145 virtual void Run() final override;
155 virtual
void Start()
override { Thread::Start(); }
158 virtual void processCommand( CmdPipe::Command& cmd ) =0;
175using MThread = alib::threads::model::MThread;
constexpr bool operator<=(TEnum lhs, typename std::underlying_type< TEnum >::type rhs) noexcept(true)
lang::uinteger uinteger
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.