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:


struct  ThreadPred
struct  tThreadData

Public Member Functions

 ThreadManager (css::uno::Reference< css::util::XJobManager > const &rThreadJoiner)
 ~ThreadManager ()
std::weak_ptr< IFinishedThreadListenerGetThreadListenerWeakRef () 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< ThreadListenermpThreadListener
oslInterlockedCount mnThreadIDCounter
std::deque< tThreadDatamaWaitingForStartThreads
std::deque< tThreadDatamaStartedThreads
Idle maStartNewThreadIdle
bool mbStartingOfThreadsSuspended

Static Private Attributes

static const std::deque< tThreadData >::size_type snStartedSize = 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)

Definition at line 38 of file threadmanager.cxx.

References false.

ThreadManager::~ThreadManager ( )

Definition at line 54 of file threadmanager.cxx.

References maStartedThreads, and maWaitingForStartThreads.

Member Function Documentation

oslInterlockedCount ThreadManager::AddThread ( const ::rtl::Reference< ObservableThread > &  rThread)
ThreadManager::DECL_LINK ( TryToStartNewThread  ,
Timer ,
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  )


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 
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().

bool ThreadManager::StartingOfThreadsSuspended ( )

Definition at line 91 of file threadmanager.hxx.

References maMutex, and mbStartingOfThreadsSuspended.

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

Definition at line 162 of file threadmanager.cxx.

References maWaitingForStartThreads, and StartThread().

Referenced by ResumeStartingOfThreads().

void ThreadManager::SuspendStartingOfThreads ( )

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

std::mutex ThreadManager::maMutex
std::deque< tThreadData > ThreadManager::maStartedThreads
Idle ThreadManager::maStartNewThreadIdle

Definition at line 125 of file threadmanager.hxx.

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

std::deque< tThreadData > ThreadManager::maWaitingForStartThreads
bool ThreadManager::mbStartingOfThreadsSuspended
oslInterlockedCount ThreadManager::mnThreadIDCounter

Definition at line 120 of file threadmanager.hxx.

Referenced by AddThread().

std::shared_ptr< ThreadListener > ThreadManager::mpThreadListener

Definition at line 118 of file threadmanager.hxx.

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

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

Definition at line 116 of file threadmanager.hxx.

Referenced by RemoveThread(), and StartThread().

const std::deque< ThreadManager::tThreadData >::size_type ThreadManager::snStartedSize = 10

class to manage threads


Definition at line 112 of file threadmanager.hxx.

Referenced by AddThread(), and ResumeStartingOfThreads().

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