TestACSThread

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

NAME

TestACSThread −

SYNOPSIS

#include <acsThreadTest.h>

Inherits ACS::Thread.

Public Member Functions

TestACSThread (const ACE_CString &name, const ACS::TimeInterval &responseTime=ThreadBase::defaultResponseTime, const ACS::TimeInterval &sleepTime=ThreadBase::defaultSleepTime, bool del=false)

TestACSThread (const ACE_CString &name, const ACS::TimeInterval &responseTime, const ACS::TimeInterval &sleepTime, bool del, const long _thrFlags)

~TestACSThread ()

virtual void runLoop ()

Protected Attributes

int loopCounter_m

Constructor & Destructor Documentation

TestACSThread::TestACSThread (const ACE_CString & name, const ACS::TimeInterval & responseTime = ThreadBase::defaultResponseTime, const ACS::TimeInterval & sleepTime = ThreadBase::defaultSleepTime, bool del = false) [inline]

References ACS_TRACE, and loopCounter_m.

TestACSThread::TestACSThread (const ACE_CString & name, const ACS::TimeInterval & responseTime, const ACS::TimeInterval & sleepTime, bool del, const long _thrFlags) [inline]

References ACS_TRACE, and loopCounter_m.

TestACSThread::~TestACSThread () [inline] Destructor.

Notice that here we have to call terminate() to protect the thread from concurrency problems. The runLoop() method uses data members of the thread (loopCounter). When the thread object get deleted, we have to be sure the thread is stopped before we delete the member variables, and therefore we have to call terminate() here.

The fact that terminate is called in the destructor of ACS::ThreadBase does not help, because it can happen the runLoop() method is called between this destructor and the ones of the parent classes.

This would cause access to already unallocated memory.

References ACS_TRACE, and ACS::ThreadBase::terminate().

Member Function Documentation

virtual void TestACSThread::runLoop () [inline, virtual] This is the method executed in the thread loop. It executes 10 times, then it exits.

Reimplemented from ACS::Thread.

References ACS_LOG, ACS::ThreadBase::exit(), ACS::ThreadBase::getName(), LM_SOURCE_INFO, and loopCounter_m.

Member Data Documentation

int TestACSThread::loopCounter_m [protected]

Referenced by runLoop(), and TestACSThread().

Author

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