![]() |
XII Release 0.1.0
|
Copyright (c) Theophilus Eriata. All Rights Reserved. More...
#include <ThreadWithDispatcher.h>
Public Types | |
| using | DispatchFunction = xiiDelegate<void(), 128> |
| Public Types inherited from xiiThread | |
| enum | xiiThreadStatus { Created = 0 , Running , Finished } |
| Describes the thread status. | |
Public Member Functions | |
| xiiThreadWithDispatcher (xiiStringView sName="xiiThreadWithDispatcher", xiiUInt32 uiStackSize=128 *1024) | |
| Initializes the runnable class. | |
| virtual | ~xiiThreadWithDispatcher () |
| Destructor checks if the thread is deleted while still running, which is not allowed as this is a data hazard. | |
| void | Dispatch (DispatchFunction &&delegate) |
| Use this to enqueue a function call to the given delegate at some later point running in the given thread context. | |
| Public Member Functions inherited from xiiThread | |
| xiiThread (xiiStringView sName="xiiThread", xiiUInt32 uiStackSize=128 *1024) | |
| Initializes the runnable class. | |
| virtual | ~xiiThread () |
| Destructor checks if the thread is deleted while still running, which is not allowed as this is a data hazard. | |
| xiiThreadStatus | GetThreadStatus () const |
| Returns the thread status. | |
| bool | IsRunning () const |
| Helper function to determine if the thread is running. | |
| xiiStringView | GetThreadName () const |
| Returns the thread name. | |
| Public Member Functions inherited from xiiOSThread | |
| xiiOSThread (xiiOSThreadEntryPoint threadEntryPoint, void *pUserData=nullptr, xiiStringView sName="xiiOSThread", xiiUInt32 uiStackSize=128 *1024) | |
| virtual | ~xiiOSThread () |
| Destructor. | |
| void | Start () |
| Starts the thread. | |
| void | Join () |
| Waits in the calling thread until the thread has finished execution (e.g. returned from the thread function). | |
| const xiiThreadID & | GetThreadID () const |
Protected Member Functions | |
| void | DispatchQueue () |
| Needs to be called by derived thread implementations to dispatch the function calls. | |
Private Member Functions | |
| virtual xiiUInt32 | Run ()=0 |
| The run function can be used to implement a long running task in a thread in a platform independent way. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from xiiThread | |
| static const xiiThread * | GetCurrentThread () |
| Returns the current xiiThread if the current platform thread is a xiiThread. Returns nullptr otherwise. | |
| Static Public Member Functions inherited from xiiOSThread | |
| static xiiInt32 | GetThreadCount () |
| Returns how many xiiOSThreads are currently active. | |
| Static Public Attributes inherited from xiiThread | |
| static xiiEvent< const xiiThreadEvent &, xiiMutex > | s_ThreadEvents |
| Copyright (c) Theophilus Eriata. All Rights Reserved. | |
| Protected Attributes inherited from xiiOSThread | |
| xiiThreadHandle | m_hHandle |
| xiiThreadID | m_ThreadID |
| xiiOSThreadEntryPoint | m_EntryPoint |
| void * | m_pUserData |
| xiiString | m_sName |
| xiiUInt32 | m_uiStackSize |
Copyright (c) Theophilus Eriata. All Rights Reserved.
This class is the base class for threads which need dispatching of calls.
Used by deriving from this class and overriding the Run() method. Call DispatchQueue() regurarely so that the collected messages can be dispatched.
| xiiThreadWithDispatcher::xiiThreadWithDispatcher | ( | xiiStringView | sName = "xiiThreadWithDispatcher", |
| xiiUInt32 | uiStackSize = 128 * 1024 ) |
Initializes the runnable class.
Copyright (c) Theophilus Eriata. All Rights Reserved.
|
privatepure virtual |
The run function can be used to implement a long running task in a thread in a platform independent way.
Implements xiiThread.