81 return mPriv->join(seconds) == 0;
86 mPriv->stopping =
true;
98 mPriv->stopping =
false;
99 return mPriv->start();
105 return mPriv->stopping;
110 return mPriv->isRunning();
124 return ThreadImpl::getCount();
130 return mPriv->getKey();
135 return ThreadImpl::getKeyOfCaller();
140 return mPriv->setPriority(priority, policy);
145 return mPriv->getPriority();
150 return mPriv->getPolicy();
void beforeStart() override
void threadRelease() override
void afterStart(bool success) override
~Private() override=default
bool threadInit() override
An abstraction for a thread of execution.
virtual void threadRelease()
Release method.
virtual bool threadInit()
Initialization method.
static long int getKeyOfCaller()
Get a unique identifier for the calling thread.
virtual ~Thread()
Destructor.
bool stop()
Stop the thread.
virtual void onStop()
Call-back, called while halting the thread (before join).
static void yield()
Reschedule the execution of current thread, allowing other threads to run.
static int getCount()
Check how many threads are running.
bool join(double seconds=-1)
The function returns when the thread execution has completed.
virtual void beforeStart()
Called just before a new thread starts.
bool isStopping()
Returns true if the thread is stopping (Thread::stop has been called).
int getPolicy()
Query the current scheduling policy of the thread, if the OS supports that.
bool isRunning()
Returns true if the thread is running (Thread::start has been called successfully and the thread has ...
long int getKey()
Get a unique identifier for the thread.
bool start()
Start the new thread running.
int setPriority(int priority, int policy=-1)
Set the priority and scheduling policy of the thread, if the OS supports that.
virtual void afterStart(bool success)
Called just after a new thread starts (or fails to start), this is executed by the same thread that c...
int getPriority()
Query the current priority of the thread, if the OS supports that.
virtual void run()=0
Main body of the new thread.
An abstraction for a thread of execution.
void yield()
The calling thread releases its remaining quantum upon calling this function.
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.