Instances of this thread-class are created by ThreadPools. Applications may extend this class and override method PrepareJob.
Definition at line 25 of file threadpool.inl.
Public Field Index: | |
| String16 | nameBuffer |
| Buffer to store the thread name given with construction. | |
| ThreadPool & | threadPool |
| The pool that this instance belongs to. | |
Public Method Index: | |
| PoolWorker (ThreadPool &pThreadPool, const character *threadName) | |
| virtual void | PrepareJob (Job *job) |
| void | Run () override |
Additional Inherited Members | |
Protected Type Index: inherited from alib::threads::Thread | |
| enum class | State { Unstarted = 0 , Started = 1 , Running = 2 , Done = 3 , Terminated = 4 } |
Protected Static Method Index: inherited from alib::threads::Thread | |
| static ALIB_DLL Thread * | Get (std::thread::id nativeID) |
| static Thread * | GetCurrent () |
| static ALIB_DLL Thread * | GetMain () |
| static void | Sleep (const Ticks::Duration &duration) |
| static void | Sleep (const Ticks::Duration::TDuration &duration) |
| static void | SleepMicros (int64_t microseconds) |
| static void | SleepMillis (int milliseconds) |
| static void | SleepNanos (int64_t nanoseconds) |
| static void | SleepUntil (const Ticks &time) |
| static void | YieldToSystem () |
Protected Field Index: inherited from alib::threads::Thread | |
| std::thread * | c11Thread =nullptr |
| The internal C++ thread object. | |
| ThreadID | id =0 |
| The id of the thread. | |
| const character * | name =nullptr |
| The name of the thread. | |
| std::thread::id | nativeID |
| The internal C++ thread id. | |
| Runnable * | runnable =nullptr |
| The runnable to execute. | |
| State | state = State::Unstarted |
| Internal flag to indicate if the thread is alive. | |
Protected Method Index: inherited from alib::threads::Thread | |
| ALIB_DLL void | destruct () |
| Thread (const character *pName=A_CHAR("")) | |
| Thread (const Thread &)=delete | |
| Deleted copy constructor. | |
| ALIB_DLL | Thread (Runnable *target, const character *pName=A_CHAR("")) |
| virtual | ~Thread () override |
| ThreadID | GetID () const |
| virtual const character * | GetName () const |
| std::thread::id | GetNativeID () const |
| State | GetState () |
| bool | IsAlive () |
| virtual ALIB_DLL void | Join () |
| virtual void | SetName (const character *newName) |
| virtual ALIB_DLL void | Start () |
Protected Method Index: inherited from alib::threads::Runnable | |
| virtual | ~Runnable () |
| Virtual destructor. | |
|
friend |
Type alias in namespace alib.
Definition at line 26 of file threadpool.inl.
| String16 alib::threadmodel::PoolWorker::nameBuffer |
Buffer to store the thread name given with construction.
Definition at line 30 of file threadpool.inl.
| ThreadPool& alib::threadmodel::PoolWorker::threadPool |
The pool that this instance belongs to.
Definition at line 27 of file threadpool.inl.
|
inline |
Constructor.
| pThreadPool | The pool that constructed us. |
| threadName | The name of this thread (for logging and diagnosis) |
Definition at line 35 of file threadpool.inl.
|
inlinevirtual |
This default implementation does nothing. Derived types may dynamically cast the parameter job to a known custom type and, for example, attach custom data found in a derived version of this class.
| job | The job to prepare. |
Definition at line 51 of file threadpool.inl.
|
overridevirtual |
Implementation of Thread::Run. Retrieves jobs from the pool, invokes PrepareJob, and then calls Job::Do.
Reimplemented from alib::threads::Thread.