ACS::ThreadManagerBase

NAME
SYNOPSIS
Detailed Description
Constructor & Destructor Documentation
Member Function Documentation
Member Data Documentation
Author

NAME

ACS::ThreadManagerBase −

Manages a pool of ACS Base threads.

SYNOPSIS

#include <acsThreadBase.h>

Inherited by ACS::ThreadManager.

Public Member Functions

ThreadManagerBase ()

~ThreadManagerBase ()

int getThreadCount () const

ACE_CString getThreadName (const int pos) const

ThreadBase * getThreadAt (const int pos) const

ThreadBase * getThreadByName (const ACE_CString &name)

ThreadBase * getThreadByID (ACE_thread_t id)

ThreadBase * create (const ACE_CString &name, void *threadProc, void *parameter, const TimeInterval &responseTime=ThreadBase::defaultResponseTime, const TimeInterval &sleepTime=ThreadBase::defaultSleepTime, const long _thrFlags=THR_NEW_LWP|THR_DETACHED, const size_t _stackSize=ACE_DEFAULT_THREAD_STACKSIZE)

bool add (const ACE_CString &name, ThreadBase *acsBaseThread)

bool stop (const ACE_CString &name)

bool stopAll ()

void exit (const ACE_CString &name)

void exitAll ()

bool cancel (const ACE_CString &name)

bool cancelAll ()

bool terminate (const ACE_CString &name)

bool terminateAll ()

bool restart (const ACE_CString &name)

bool restartAll ()

bool restartDead ()

bool suspend (const ACE_CString &name)

bool suspendAll ()

bool resume (const ACE_CString &name)

bool resumeAll ()

bool isAlive (const ACE_CString &name)

bool areAllAlive ()

int join (const ACE_thread_t &tid)

int join (const ThreadBase *th)

ACE_Thread_Manager * getACEThreadManager ()

Protected Member Functions

void add2map (const ACE_CString &name, ThreadBase *thread)

void removeFromMap (const ACE_CString &name)

Protected Attributes

ACE_Recursive_Thread_Mutex m_addRemoveMutex

mutex used by add and remove method

Private Member Functions

void operator= (const ThreadManagerBase &)

ThreadManagerBase (const ThreadManagerBase &)

Private Attributes

ACE_Thread_Manager * threadManager_mp

pointer to ACE_Threads_Manager

ThreadMap threadMap_m

Thread name-thread map data store.

std::vector< ThreadBase * > threads_m

Vector of all threads.

Detailed Description

Manages a pool of ACS Base threads.

Todo

GCH Why a forward declaration for the Thread class here? Thread Base should be sufficient !!!!! Try to remove it and see what happens.

Constructor & Destructor Documentation

ACS::ThreadManagerBase::ThreadManagerBase () [inline] Todo

GCH Why a friend declaration for the Thread class here? Thread Base should be sufficient !!!!! Try to remove it and see what happens.

Constructor.

References threadManager_mp.

ACS::ThreadManagerBase::~ThreadManagerBase () Destructor. Also terminates and deletes all threads.

ACS::ThreadManagerBase::ThreadManagerBase (const ThreadManagerBase &) [private] ALMA C++ coding standards state copy constructors should be disabled.

Member Function Documentation

bool ACS::ThreadManagerBase::add (const ACE_CString & name, ThreadBase * acsBaseThread) Add a thread to the ThreadBaseManger thread pool. WARNING: after this operation ThreadManagerBase owns the pointer of ThreadBase. ThreadBase object is deleted on destruction of ThreadManagerBase object. Therefore the given ThreadBase must have been allocated on the heap

Parameters:

name name of the thread
ThreadBase pointer to the thread

void ACS::ThreadManagerBase::add2map (const ACE_CString & name, ThreadBase * thread) [inline, protected] Add a thread to the ThreadManagerBase data store.

Parameters:

name name of the thread
thread
pointer to the thread

References threadMap_m, and threads_m.

bool ACS::ThreadManagerBase::areAllAlive () Checks if all threads are alive (not terminated).

Parameters:

name name of the thread

Returns:

true if all threads are alive

See also:

ThreadManagerBase::isAlive

bool ACS::ThreadManagerBase::cancel (const ACE_CString & name) Cancel (forceful termination) named thread. Avoid using this kind of thread termination.

Parameters:

name name of the thread

See also:

ThreadBase::cancel

ThreadManagerBase::terminate

bool ACS::ThreadManagerBase::cancelAll () Cancel (forceful termination) all threads.

See also:

ThreadManagerBase::cancel

ThreadBase* ACS::ThreadManagerBase::create (const ACE_CString & name, void * threadProc, void * parameter, const TimeInterval & responseTime = ThreadBase::defaultResponseTime, const TimeInterval & sleepTime = ThreadBase::defaultSleepTime, const long _thrFlags = THR_NEW_LWP|THR_DETACHED, const size_t _stackSize = ACE_DEFAULT_THREAD_STACKSIZE) Create a new thread and add it to the pool. The thread is immediately created (create=true) and suspended

Parameters:

name of the thread
threadProc
thread worker function
parameter
an optional parameter to the thread
responseTime
heartbeat response time in 100ns unit
sleepTime
default sleep time in 100ns unit
_thrFlags
Thread creation flags to be used if _create = TRUE. See ACE threads and pthread documentation for details. Default is now THR_NEW_LWP | THR_DETACHED

Returns:

pointer to ThreadBase object, NULL otherwise

See also:

ThreadBase

void ACS::ThreadManagerBase::exit (const ACE_CString & name) Notify named thread to exit thread worker function.

Parameters:

name name of the thread

See also:

ThreadBase::exit

void ACS::ThreadManagerBase::exitAll () Notify all the threads to exit thread worker function.

See also:

ThreadManagerBase::exit

ACE_Thread_Manager* ACS::ThreadManagerBase::getACEThreadManager () [inline] Returns pointer to the ACE Thread Manager

Returns:

pointer to ACE_Thread_Manager object

References threadManager_mp.

ThreadBase* ACS::ThreadManagerBase::getThreadAt (const int pos) const [inline] Get thread at the specified position.

Parameters:

pos position of the thread

Returns:

pointer to ThreadBase object

References threads_m.

ThreadBase* ACS::ThreadManagerBase::getThreadByID (ACE_thread_t id) [inline] Get thread with specified ID.

Parameters:

id ID of the thread

Returns:

pointer to ThreadBase object, NULL otherwise

References threads_m.

ThreadBase* ACS::ThreadManagerBase::getThreadByName (const ACE_CString & name) [inline] Get thread with specified named.

Parameters:

name name of the thread

Returns:

pointer to ThreadBase object, NULL otherwise

References m_addRemoveMutex, and threadMap_m.

int ACS::ThreadManagerBase::getThreadCount () const [inline] Get number of threads in the pool.

Returns:

number of threads in the pool

References threads_m.

ACE_CString ACS::ThreadManagerBase::getThreadName (const int pos) const [inline] Get name of the thread at the specified position.

Parameters:

pos position of the thread

Returns:

name of the thread

References threads_m.

bool ACS::ThreadManagerBase::isAlive (const ACE_CString & name) Checks if named thread is alive (not terminated).

Parameters:

name name of the thread

Returns:

true if named thread is alive

See also:

ThreadBase::isAlive

int ACS::ThreadManagerBase::join (const ACE_thread_t & tid) join joinable thread

Parameters:

tid thread id

Returns:

-1 if fail

int ACS::ThreadManagerBase::join (const ThreadBase * th) join joinable thread

Parameters:

pointer to thread

Returns:

-1 if fail

void ACS::ThreadManagerBase::operator= (const ThreadManagerBase &) [private] ALMA C++ coding standards state assignment operators should be disabled.

void ACS::ThreadManagerBase::removeFromMap (const ACE_CString & name) [inline, protected]

References m_addRemoveMutex, threadMap_m, and threads_m.

bool ACS::ThreadManagerBase::restart (const ACE_CString & name) Restart named thread. Restarting means treminate and recreate a new thread.

Parameters:

name name of the thread

See also:

ThreadBase::restart

bool ACS::ThreadManagerBase::restartAll () Restart all threads.

See also:

ThreadManagerBase::restart

bool ACS::ThreadManagerBase::restartDead () Restart all dead threads, i.e. all terminated threads

See also:

ThreadManagerBase::restart

ThreadManagerBase::isAlive

bool ACS::ThreadManagerBase::resume (const ACE_CString & name) Continue the execution of a previously suspended thread.

Parameters:

name name of the thread

See also:

ThreadBase::resume

bool ACS::ThreadManagerBase::resumeAll () Continue the execution of all suspended threads.

See also:

ThreadManagerBase::resume

bool ACS::ThreadManagerBase::stop (const ACE_CString & name) Stop named thread.

Parameters:

name name of the thread

Returns:

true if thread has been stopped

See also:

ThreadBase::stop

bool ACS::ThreadManagerBase::stopAll () Stop all the threads_m.

Returns:

true if thread has been stopped

See also:

ThreadManagerBase::stop

bool ACS::ThreadManagerBase::suspend (const ACE_CString & name) Suspend the execution of a particular thread.

Parameters:

name name of the thread

See also:

ThreadBase::suspend

bool ACS::ThreadManagerBase::suspendAll () Suspend the execution of all running threads.

See also:

ThreadManagerBase::suspend

bool ACS::ThreadManagerBase::terminate (const ACE_CString & name) Terminate named thread.

Parameters:

name name of the thread

See also:

ThreadBase::terminate

bool ACS::ThreadManagerBase::terminateAll () Terminate all threads.

See also:

ThreadManagerBase::terminate

Member Data Documentation

ACE_Recursive_Thread_Mutex ACS::ThreadManagerBase::m_addRemoveMutex [protected]

mutex used by add and remove method

Referenced by getThreadByName(), and removeFromMap().

ACE_Thread_Manager* ACS::ThreadManagerBase::threadManager_mp [private]

pointer to ACE_Threads_Manager

Referenced by getACEThreadManager(), and ThreadManagerBase().

ThreadMap ACS::ThreadManagerBase::threadMap_m [private]

Thread name-thread map data store.

Referenced by add2map(), getThreadByName(), and removeFromMap().

std::vector<ThreadBase*> ACS::ThreadManagerBase::threads_m [private]

Vector of all threads.

Referenced by add2map(), getThreadAt(), getThreadByID(), getThreadCount(), getThreadName(), and removeFromMap().

Author

Generated automatically by Doxygen for ACS-2015.2 C++ API from the source code.