rpa::thread_copy< ThrMain > Class Template Reference

This stays allocated as long as the thread is running. More...

#include <synchro.h>

List of all members.

Public Member Functions

 thread_copy (const ThrMain &refThr)
 Behaves exactly like the base class, except for delete and join.
void join (void)
 This object destroys itself, but is allocated by the thread_tree.

Protected Member Functions

 ~thread_copy ()
 Only this object can destroy itself. Therefore destructor is protected.

Private Member Functions

 thread_copy ()
 thread_copy (const thread_copy &)
thread_copyoperator= (const thread_copy &)


Detailed Description

template<class ThrMain>
class rpa::thread_copy< ThrMain >

This stays allocated as long as the thread is running.

http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.15

[16.15] Is it legal (and moral) for a member function to say delete this?

1. You must be absolutely 100% positive sure that this object was allocated via new (not by new[], nor by placement new, nor a local object on the stack, nor a global, nor a member of another object; but by plain ordinary new). 2. You must be absolutely 100% positive sure that your member function will be the last member function invoked on this object. 3. You must be absolutely 100% positive sure that the rest of your member function (after the delete this line) doesn't touch any piece of this object (including calling any other member functions or touching any data members). 4. You must be absolutely 100% positive sure that no one even touches the this pointer itself after the delete this line. In other words, you must not examine it, compare it with another pointer, compare it with NULL, print it, cast it, do anything with it.

Naturally the usual caveats apply in cases where your this pointer is a pointer to a base class when you don't have a virtual destructor


Constructor & Destructor Documentation

template<class ThrMain>
rpa::thread_copy< ThrMain >::thread_copy (  )  [private]

template<class ThrMain>
rpa::thread_copy< ThrMain >::thread_copy ( const thread_copy< ThrMain > &   )  [private]

template<class ThrMain>
rpa::thread_copy< ThrMain >::~thread_copy (  )  [inline, protected]

Only this object can destroy itself. Therefore destructor is protected.

template<class ThrMain>
rpa::thread_copy< ThrMain >::thread_copy ( const ThrMain &  refThr  )  [inline, explicit]

Behaves exactly like the base class, except for delete and join.


Member Function Documentation

template<class ThrMain>
void rpa::thread_copy< ThrMain >::join ( void   )  [inline]

This object destroys itself, but is allocated by the thread_tree.

template<class ThrMain>
thread_copy& rpa::thread_copy< ThrMain >::operator= ( const thread_copy< ThrMain > &   )  [private]


The documentation for this class was generated from the following file:
Generated on Tue Sep 25 10:20:38 2007 for rpa by  doxygen 1.4.7