Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

TestACSThread Class Reference

#include <acsThreadTest.h>

Inheritance diagram for TestACSThread:

Inheritance graph
[legend]
Collaboration diagram for TestACSThread:

Collaboration graph
[legend]
List of all members.

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]
 

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

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.


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.


Member Data Documentation

int TestACSThread::loopCounter_m [protected]
 


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:36:56 2009 for ACS C++ API by doxygen 1.3.8