78 return mPriv->join(
seconds) == 0;
83 mPriv->stopping =
true;
95 mPriv->stopping =
false;
96 return mPriv->start();
102 return mPriv->stopping;
107 return mPriv->isRunning();
127 return mPriv->getKey();
137 return mPriv->setPriority(priority, policy);
142 return mPriv->getPriority();
147 return mPriv->getPolicy();
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
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.
static long int getKeyOfCaller()
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.