MITHREAD::LOCALSTORAGE_T< _CT > Class Template Reference

Template class to assist in handling thread local storage data This class is to be used ONLY from a local static variable in a static function or method. More...

#include <mi32/thrlcstr.h>

Inheritance diagram for MITHREAD::LOCALSTORAGE_T< _CT >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~LOCALSTORAGE_T ()
_CT * GetValue ()

Detailed Description

template<class _CT>
class MITHREAD::LOCALSTORAGE_T< _CT >

Template class to assist in handling thread local storage data This class is to be used ONLY from a local static variable in a static function or method.

Any other use will cause memory leaks and / or process instability.

   class GETERRSTRDATA : public MITHREAD::LOCALSTORAGE::BASE {
      public:
         GETERRSTRDATA (
            ) {}
            
         virtual ~GETERRSTRDATA (
            ) {}
            
         ERRORSTATE& GetErrorStateRef (
            ) { return (m_ErrorState); }
 
         static void TLSSystemClose (
            ) { s_ErrorSystemDisabled = true; }       // Do not allow any more calls to the error system
      
      private:
         ERRORSTATE m_ErrorState;
      };


   ERRORSTATE& ERRORSTATE::GetThreadErrStateRef (
      ) {
      static MITHREAD::LOCALSTORAGE_T<GETERRSTRDATA> s_ErrTLS;
    
      return (s_ErrTLS.GetValue()->GetErrorStateRef());
      }

Constructor & Destructor Documentation

template<class _CT>
virtual MITHREAD::LOCALSTORAGE_T< _CT >::~LOCALSTORAGE_T (  )  [inline, virtual]

Default virtual dtor Makes a call to a 'static' method on the template class called TLSSystemClose().

There is no default method for this, nor can it be virtual or non-static. This tells the class in question that the dtor for the THREADLOCALSTORAGE class is being called. The error reporting system uses this to determine that it cannot handle any more errors.


Member Function Documentation

template<class _CT>
_CT* MITHREAD::LOCALSTORAGE_T< _CT >::GetValue (  )  [inline]

Get the TLS data from the presumably global variable.

I considered replacing this with operator->(), but that would cause more overhead than simply getting the pointer and using it

Returns:
'_T*' defined on the declaration line

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

Generated on Sun Oct 7 21:36:39 2012 for TNTsdk 2012 by  doxygen 1.6.1