LibreOffice Module sw (master)  1
Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ThreadManager Class Referencefinal

class to manage threads More...

#include <threadmanager.hxx>

Collaboration diagram for ThreadManager:
[legend]

Classes

struct  ThreadPred
 
struct  tThreadData
 

Public Member Functions

 ThreadManager (css::uno::Reference< css::util::XJobManager > const &rThreadJoiner)
 
 ~ThreadManager ()
 
std::weak_ptr< IFinishedThreadListenerGetThreadListenerWeakRef ()
 
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

osl::Mutex maMutex
 
css::uno::WeakReference< css::util::XJobManager > mrThreadJoiner
 
std::shared_ptr< ThreadListenermpThreadListener
 
oslInterlockedCount mnThreadIDCounter
 
std::deque< tThreadDatamaWaitingForStartThreads
 
std::deque< tThreadDatamaStartedThreads
 
Idle maStartNewThreadIdle
 
bool mbStartingOfThreadsSuspended
 

Static Private Attributes

static const std::deque< tThreadData >::size_type mnStartedSize = 10
 class to manage threads More...
 

Detailed Description

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.

Constructor & Destructor Documentation

ThreadManager::ThreadManager ( css::uno::Reference< css::util::XJobManager > const &  rThreadJoiner)
explicit

Definition at line 38 of file threadmanager.cxx.

References maMutex.

ThreadManager::~ThreadManager ( )

Definition at line 58 of file threadmanager.cxx.

References maStartedThreads, and maWaitingForStartThreads.

Member Function Documentation

oslInterlockedCount ThreadManager::AddThread ( const ::rtl::Reference< ObservableThread > &  rThread)
ThreadManager::DECL_LINK ( TryToStartNewThread  ,
Timer ,
void   
)
std::weak_ptr< IFinishedThreadListener > ThreadManager::GetThreadListenerWeakRef ( )

Definition at line 64 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 50 of file threadmanager.cxx.

References LINK, maStartNewThreadIdle, mpThreadListener, Timer::SetInvokeHandler(), and Task::SetPriority().

void ThreadManager::NotifyAboutFinishedThread ( const oslInterlockedCount  nThreadID)

Definition at line 69 of file threadmanager.cxx.

References RemoveThread().

Referenced by ThreadListener::NotifyAboutFinishedThread().

void ThreadManager::RemoveThread ( const oslInterlockedCount  nThreadID,
const bool  bThreadFinished = false 
)
void ThreadManager::ResumeStartingOfThreads ( )

continues the starting of threads after it has been suspended

Definition at line 230 of file threadmanager.cxx.

References maMutex, maStartedThreads, maStartNewThreadIdle, maWaitingForStartThreads, mbStartingOfThreadsSuspended, mnStartedSize, Idle::Start(), and StartWaitingThread().

bool ThreadManager::StartingOfThreadsSuspended ( )
inline

Definition at line 91 of file threadmanager.hxx.

References maMutex, and mbStartingOfThreadsSuspended.

Referenced by AddThread().

bool ThreadManager::StartThread ( const tThreadData aThreadData)
private
bool ThreadManager::StartWaitingThread ( )
private

Definition at line 165 of file threadmanager.cxx.

References maWaitingForStartThreads, and StartThread().

Referenced by ResumeStartingOfThreads().

void ThreadManager::SuspendStartingOfThreads ( )
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.

Member Data Documentation

osl::Mutex ThreadManager::maMutex
private
std::deque< tThreadData > ThreadManager::maStartedThreads
private
Idle ThreadManager::maStartNewThreadIdle
private

Definition at line 125 of file threadmanager.hxx.

Referenced by AddThread(), Init(), and ResumeStartingOfThreads().

std::deque< tThreadData > ThreadManager::maWaitingForStartThreads
private
bool ThreadManager::mbStartingOfThreadsSuspended
private
const std::deque< ThreadManager::tThreadData >::size_type ThreadManager::mnStartedSize = 10
staticprivate

class to manage threads

#i73788#

Definition at line 112 of file threadmanager.hxx.

Referenced by AddThread(), and ResumeStartingOfThreads().

oslInterlockedCount ThreadManager::mnThreadIDCounter
private

Definition at line 120 of file threadmanager.hxx.

Referenced by AddThread().

std::shared_ptr< ThreadListener > ThreadManager::mpThreadListener
private

Definition at line 118 of file threadmanager.hxx.

Referenced by AddThread(), GetThreadListenerWeakRef(), and Init().

css::uno::WeakReference< css::util::XJobManager > ThreadManager::mrThreadJoiner
private

Definition at line 116 of file threadmanager.hxx.

Referenced by RemoveThread(), and StartThread().


The documentation for this class was generated from the following files: