LibreOffice Module sw (master) 1
|
class to manage threads More...
#include <threadmanager.hxx>
Classes | |
struct | ThreadPred |
struct | tThreadData |
Public Member Functions | |
ThreadManager (css::uno::Reference< css::util::XJobManager > const &rThreadJoiner) | |
~ThreadManager () | |
std::weak_ptr< IFinishedThreadListener > | GetThreadListenerWeakRef () const |
void | NotifyAboutFinishedThread (const oslInterlockedCount nThreadID) |
void | Init () |
initialization More... | |
oslInterlockedCount | AddThread (const ::rtl::Reference< ObservableThread > &rThread) |
add thread to the thread manager and taking ownership for the thread More... | |
void | RemoveThread (const oslInterlockedCount nThreadID, const bool bThreadFinished=false) |
DECL_LINK (TryToStartNewThread, Timer *, void) | |
void | SuspendStartingOfThreads () |
suspend the starting of threads More... | |
void | ResumeStartingOfThreads () |
continues the starting of threads after it has been suspended More... | |
bool | StartingOfThreadsSuspended () |
Private Member Functions | |
bool | StartWaitingThread () |
bool | StartThread (const tThreadData &aThreadData) |
Private Attributes | |
std::mutex | maMutex |
css::uno::WeakReference< css::util::XJobManager > | mrThreadJoiner |
std::shared_ptr< ThreadListener > | mpThreadListener |
oslInterlockedCount | mnThreadIDCounter |
std::deque< tThreadData > | maWaitingForStartThreads |
std::deque< tThreadData > | maStartedThreads |
Idle | maStartNewThreadIdle |
bool | mbStartingOfThreadsSuspended |
Static Private Attributes | |
static const std::deque< tThreadData >::size_type | snStartedSize = 10 |
class to manage threads More... | |
class to manage threads
OD 2007-01-29 #i73788# An instance of this class takes care of the starting of threads. It assures that not more than <mnStartedSize> threads are started.
Definition at line 47 of file threadmanager.hxx.
|
explicit |
Definition at line 38 of file threadmanager.cxx.
ThreadManager::~ThreadManager | ( | ) |
Definition at line 54 of file threadmanager.cxx.
References maStartedThreads, and maWaitingForStartThreads.
oslInterlockedCount ThreadManager::AddThread | ( | const ::rtl::Reference< ObservableThread > & | rThread | ) |
add thread to the thread manager and taking ownership for the thread
Definition at line 70 of file threadmanager.cxx.
References ThreadManager::tThreadData::aJob, maMutex, maStartedThreads, maStartNewThreadIdle, maWaitingForStartThreads, mbStartingOfThreadsSuspended, mnThreadIDCounter, mpThreadListener, ThreadManager::tThreadData::nThreadID, ThreadManager::tThreadData::pThread, snStartedSize, Idle::Start(), and StartThread().
ThreadManager::DECL_LINK | ( | TryToStartNewThread | , |
Timer * | , | ||
void | |||
) |
std::weak_ptr< IFinishedThreadListener > ThreadManager::GetThreadListenerWeakRef | ( | ) | const |
Definition at line 60 of file threadmanager.cxx.
References mpThreadListener.
Referenced by ThreadListener::ListenToThread().
void ThreadManager::Init | ( | void | ) |
initialization
IMPORTANT NOTE: Needs to be called directly after construction
Definition at line 46 of file threadmanager.cxx.
References LINK, maStartNewThreadIdle, mpThreadListener, Timer::SetInvokeHandler(), and Task::SetPriority().
void ThreadManager::NotifyAboutFinishedThread | ( | const oslInterlockedCount | nThreadID | ) |
Definition at line 65 of file threadmanager.cxx.
References RemoveThread().
Referenced by ThreadListener::NotifyAboutFinishedThread().
void ThreadManager::RemoveThread | ( | const oslInterlockedCount | nThreadID, |
const bool | bThreadFinished = false |
||
) |
Definition at line 115 of file threadmanager.cxx.
References ThreadManager::tThreadData::aJob, maMutex, maStartedThreads, maWaitingForStartThreads, and mrThreadJoiner.
Referenced by NotifyAboutFinishedThread().
void ThreadManager::ResumeStartingOfThreads | ( | ) |
continues the starting of threads after it has been suspended
Definition at line 227 of file threadmanager.cxx.
References maMutex, maStartedThreads, maStartNewThreadIdle, maWaitingForStartThreads, mbStartingOfThreadsSuspended, snStartedSize, Idle::Start(), and StartWaitingThread().
|
inline |
Definition at line 91 of file threadmanager.hxx.
References maMutex, and mbStartingOfThreadsSuspended.
|
private |
Definition at line 176 of file threadmanager.cxx.
References ThreadManager::tThreadData::aJob, maStartedThreads, maWaitingForStartThreads, mrThreadJoiner, and ThreadManager::tThreadData::pThread.
Referenced by AddThread(), and StartWaitingThread().
|
private |
Definition at line 162 of file threadmanager.cxx.
References maWaitingForStartThreads, and StartThread().
Referenced by ResumeStartingOfThreads().
|
inline |
suspend the starting of threads
Suspending the starting of further threads is sensible during the destruction of a Writer document.
Definition at line 80 of file threadmanager.hxx.
References maMutex, and mbStartingOfThreadsSuspended.
|
private |
Definition at line 114 of file threadmanager.hxx.
Referenced by AddThread(), RemoveThread(), ResumeStartingOfThreads(), StartingOfThreadsSuspended(), and SuspendStartingOfThreads().
|
private |
Definition at line 123 of file threadmanager.hxx.
Referenced by AddThread(), RemoveThread(), ResumeStartingOfThreads(), StartThread(), and ~ThreadManager().
|
private |
Definition at line 125 of file threadmanager.hxx.
Referenced by AddThread(), Init(), and ResumeStartingOfThreads().
|
private |
Definition at line 122 of file threadmanager.hxx.
Referenced by AddThread(), RemoveThread(), ResumeStartingOfThreads(), StartThread(), StartWaitingThread(), and ~ThreadManager().
|
private |
Definition at line 127 of file threadmanager.hxx.
Referenced by AddThread(), ResumeStartingOfThreads(), StartingOfThreadsSuspended(), and SuspendStartingOfThreads().
|
private |
Definition at line 120 of file threadmanager.hxx.
Referenced by AddThread().
|
private |
Definition at line 118 of file threadmanager.hxx.
Referenced by AddThread(), GetThreadListenerWeakRef(), and Init().
|
private |
Definition at line 116 of file threadmanager.hxx.
Referenced by RemoveThread(), and StartThread().
|
staticprivate |
class to manage threads
#i73788#
Definition at line 112 of file threadmanager.hxx.
Referenced by AddThread(), and ResumeStartingOfThreads().