![]() |
KSquare Utilities
|
#include <KKThreadManager.h>
Inheritance diagram for KKB::KKThreadManager:Public Member Functions | |
| KKThreadManager (const KKStr &_managerName, kkuint32 _maxNumThreads, MsgQueuePtr _msgQueue) | |
| ~KKThreadManager () | |
| void | AddThread (KKThreadPtr _thread) |
| bool | AllThreadsTerminated () |
| bool | AnyProcessorsCrashed () |
| const bool & | Crashed () const |
| const bool & | DoneExecuting () const |
| void | KillAllRunningThreads () |
| void | ManageThreads (bool &successful) |
| void | RequestShutdown () |
| void | RequestTerminate () |
| virtual void | Run () |
| const bool & | ShutdownFlag () const |
| void | ShutdownProcessing (kkint32 miliSecsToWait) |
| Shutdown all threads in a orderly way; observing prerequisite ordering. More... | |
| void | TerminateProcessing () |
Public Member Functions inherited from KKB::KKThread | |
| KKThread (const KKStr &_threadName, KKThreadManagerPtr _threadManager, MsgQueuePtr _msgQueue) | |
| virtual | ~KKThread () |
| void | AddShutdownPrerequistite (KKThreadPtr _thread) |
| Specify threads that must stop before this thread is started. More... | |
| void | AddStartPrerequistite (KKThreadPtr _thread) |
| Specify threads that must start before this thread is started. More... | |
| VolConstBool & | CancelFlag () const |
| bool | Crashed () const |
| void | Crashed (bool _crashed) |
| const KKStr & | ExceptionText () const |
| void | ExceptionText (const KKStr &_exceptionText) |
| KKStrListPtr | GetMsgs () |
| void | Kill () |
| stops the running thread and frees the thread handle More... | |
| kkint32 | MemoryConsumedEstimated () |
| KKB::MsgQueuePtr | MsgQueue () |
| bool | OkToShutdown () const |
| bool | OkToStart () const |
| VolConstBool & | ShutdownFlag () const |
| void | ShutdownThread () |
| void | Start (ThreadPriority _priority, bool &successful) |
| ThreadStatus | Status () const |
| void | Status (ThreadStatus _status) |
| const KKStr & | StatusStr () const |
| VolConstBool & | TerminateFlag () const |
| virtual void | TerminateFlagChanged () |
| Will be called whenever the value of 'terminateFlag' is changed; derived classes should override this method if they need to be aware that the terminaeFlag has changed. This give them a chance to let other objects/methods know that the flag has changed. More... | |
| void | TerminateThread () |
| kkint32 | ThreadId () const |
| const KKStr & | ThreadName () const |
| bool | ThreadStillProcessing () const |
| void | WaitForThreadToStop (kkuint32 maxTimeToWait) |
| Called by separate thread; will stay in loop until the thread controlled by this instance shutdown or it waited the 'maxTimeToWait'. More... | |
Additional Inherited Members | |
Public Types inherited from KKB::KKThread | |
| typedef KKThread * | KKThreadPtr |
| enum | ThreadPriority : int { ThreadPriority::Null, ThreadPriority::Low, ThreadPriority::Normal, ThreadPriority::High } |
| enum | ThreadStatus : int { ThreadStatus::Null, ThreadStatus::NotStarted, ThreadStatus::Starting, ThreadStatus::Running, ThreadStatus::Stopping, ThreadStatus::Stopped } |
Static Public Member Functions inherited from KKB::KKThread | |
| static const KKStr & | ThreadStatusToStr (ThreadStatus) |
Protected Member Functions inherited from KKB::KKThread | |
| void | AddMsg (KKStrPtr msg) |
| void | AddMsg (const KKStr &msg) |
| bool | ShutdownOrTerminateRequested () |
| bool | ThereIsACircularReferenceShutdown (KKThreadPtr _thread) const |
| bool | ThereIsACircularReferenceStart (KKThreadPtr _thread) const |
Definition at line 37 of file KKThreadManager.h.
| KKThreadManager::KKThreadManager | ( | const KKStr & | _managerName, |
| kkuint32 | _maxNumThreads, | ||
| MsgQueuePtr | _msgQueue | ||
| ) |
Definition at line 23 of file KKThreadManager.cpp.
References KKB::KKThread::KKThread(), and KKB::KKThreadList::KKThreadList().
| KKThreadManager::~KKThreadManager | ( | ) |
Definition at line 44 of file KKThreadManager.cpp.
| void KKThreadManager::AddThread | ( | KKThreadPtr | _thread | ) |
Add thread that is to be managed; will take ownership
Definition at line 52 of file KKThreadManager.cpp.
References KKB::KKThreadList::KKThreadList().
| bool KKThreadManager::AllThreadsTerminated | ( | ) |
Definition at line 280 of file KKThreadManager.cpp.
References KKB::KKThread::Status(), and KKB::KKThread::Stopped.
| bool KKThreadManager::AnyProcessorsCrashed | ( | ) |
Definition at line 255 of file KKThreadManager.cpp.
References KKB::KKThread::Crashed().
Referenced by ManageThreads().
|
inline |
Definition at line 48 of file KKThreadManager.h.
|
inline |
Definition at line 49 of file KKThreadManager.h.
| void KKThreadManager::KillAllRunningThreads | ( | ) |
Will STOP ALL running threads; NOT Grace-full;
Definition at line 185 of file KKThreadManager.cpp.
References KKB::KKThread::Kill().
Referenced by ShutdownProcessing().
| void KKThreadManager::ManageThreads | ( | bool & | successful | ) |
Definition at line 305 of file KKThreadManager.cpp.
References AnyProcessorsCrashed(), KKB::osSleep(), ShutdownProcessing(), and TerminateProcessing().
| void KKThreadManager::RequestShutdown | ( | ) |
Definition at line 62 of file KKThreadManager.cpp.
| void KKThreadManager::RequestTerminate | ( | ) |
Definition at line 68 of file KKThreadManager.cpp.
|
virtual |
|
inline |
Definition at line 47 of file KKThreadManager.h.
| void KKThreadManager::ShutdownProcessing | ( | kkint32 | miliSecsToWait | ) |
Shutdown all threads in a orderly way; observing prerequisite ordering.
Definition at line 93 of file KKThreadManager.cpp.
References KillAllRunningThreads(), KKB::KKThread::NotStarted, KKB::KKThread::Null, KKB::KKThread::OkToShutdown(), KKB::osSleep(), KKB::KKThread::Running, KKB::KKThread::ShutdownFlag(), KKB::KKThread::ShutdownThread(), KKB::KKThread::Starting, KKB::KKThread::Status(), KKB::KKThread::Stopped, and KKB::KKThread::Stopping.
Referenced by ManageThreads().
| void KKThreadManager::TerminateProcessing | ( | ) |
Flag all All running threads to Terminate ASAP and release all allocated resources.
Definition at line 76 of file KKThreadManager.cpp.
References KKB::KKThread::TerminateThread().
Referenced by ManageThreads().