#include <Thread.h>
|
using | Id = std::thread::id |
|
Base thread object.
Should be used for deriving a user thread by overwriting threadFunction().
◆ Id
◆ Thread()
sptk::Thread::Thread |
( |
const String & |
name, |
|
|
const std::shared_ptr< ThreadManager > & |
threadManager = nullptr |
|
) |
| |
|
explicit |
Constructor
- Parameters
-
name | Name of the thread for future references. |
threadManager | Optional thread manager. If provided, then it owns the created thread's memory. |
◆ ~Thread()
virtual sptk::Thread::~Thread |
( |
| ) |
|
|
virtual |
◆ id()
Id sptk::Thread::id |
( |
| ) |
const |
Returns this thread OS id
◆ join()
virtual void sptk::Thread::join |
( |
| ) |
|
|
virtual |
◆ name()
const String & sptk::Thread::name |
( |
| ) |
const |
|
inline |
Returns the name of the thread
◆ onThreadExit()
virtual void sptk::Thread::onThreadExit |
( |
| ) |
|
|
inlinevirtual |
This method is executed immediately after thread function exit
◆ run()
virtual void sptk::Thread::run |
( |
| ) |
|
|
virtual |
◆ running()
bool sptk::Thread::running |
( |
| ) |
const |
◆ sleep_for()
virtual bool sptk::Thread::sleep_for |
( |
std::chrono::milliseconds |
interval | ) |
|
|
virtual |
Sleep for interval of time The sleep is automatically interrupted when terminate() is called.
- Parameters
-
◆ sleep_until()
virtual bool sptk::Thread::sleep_until |
( |
const DateTime & |
timestamp | ) |
|
|
virtual |
Sleep until moment of time The pause is automatically interrupted when terminate() is called.
- Parameters
-
◆ terminate()
virtual void sptk::Thread::terminate |
( |
| ) |
|
|
virtual |
◆ terminated()
virtual bool sptk::Thread::terminated |
( |
| ) |
|
|
virtual |
Returns true if the thread is terminated
◆ threadFunction()
virtual void sptk::Thread::threadFunction |
( |
| ) |
|
|
pure virtual |
The documentation for this class was generated from the following file: