Instances of this thread-class are created by ThreadPools. Applications may extend this class and override the method PrepareJob.
Definition at line 19 of file threadpool.inl.
Public Field Index: | |
| String64 | 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 Thread * | Get (std::thread::id nativeID) |
| static Thread * | GetCurrent () |
| static 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 | |
| void | destruct () |
| Thread (const character *pName=A_CHAR("")) | |
| Thread (const Thread &)=delete | |
| Deleted copy constructor. | |
| 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 void | Join () |
| virtual void | SetName (const character *newName) |
| virtual void | Start () |
| Protected Method Index: inherited from alib::threads::Runnable | |
| virtual | ~Runnable () |
| Virtual destructor. | |
| String64 alib::threadmodel::PoolWorker::nameBuffer |
Buffer to store the thread name given with construction.
Definition at line 26 of file threadpool.inl.
| ThreadPool& alib::threadmodel::PoolWorker::threadPool |
The pool that this instance belongs to.
Definition at line 23 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 31 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 47 of file threadpool.inl.
|
overridevirtual |
Implementation of virtual void Run() override. Retrieves jobs from the pool, invokes PrepareJob, and then calls virtual bool Do() .
Reimplemented from alib::threads::Thread.