Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_TSS Class Template Reference

Allows objects that are "physically" in thread specific storage (i.e., private to a thread) to be accessed as though they were "logically" global to a program. More...

`#include <Synch_T.h>`

Collaboration diagram for ACE_TSS:

[legend]
List of all members.

## Public Methods
| ACE_TSS (TYPE *ts_obj=0)
virtual | ~ACE_TSS (void)
| Deregister with thread-key administration. More...
TYPE * | ts_object (void) const
TYPE * | ts_object (TYPE *)
| Set the thread-specific object for the key associated with this object. More...
TYPE * | operator-> () const
| Use a "smart pointer" to get the thread-specific object associated with the <key_>. More...
| operator TYPE * (void) const
| Return or create and return the calling threads TYPE object. More...
virtual TYPE * | make_TSS_TYPE (void) const
| Hook for construction parameters. More...
void | dump (void) const
| Dump the state of an object. More...
## Protected Methods
TYPE * | ts_get (void) const
| Actually implements the code that retrieves the object from thread-specific storage. More...
int | ts_init (void) const
| Factors out common code for initializing TSS. This must NOT be called with the lock held... More...
void | operator= (const ACE_TSS< TYPE > &)
| ACE_TSS (const ACE_TSS< TYPE > &)
## Protected Attributes
TYPE * | type_
| This implementation only works for non-threading systems... More...

## Detailed Description

### template<class TYPE>
class ACE_TSS< TYPE >

Allows objects that are "physically" in thread specific storage (i.e., private to a thread) to be accessed as though they were "logically" global to a program.

This class is a wrapper around the OS thread library thread-specific functions. It uses the <C++ operator->> to shield applications from the details of accessing thread-specific storage.

NOTE: For maximal portability, <TYPE> cannot be a built-in type, but instead should be a user-defined class (some compilers will allow a built-in type, others won't). See template class ACE_TSS_Type_Adapter, below, for adapting built-in types to work with ACE_TSS.

## Constructor & Destructor Documentation

template<class TYPE>
ACE_INLINE ACE_TSS< TYPE >::ACE_TSS | ( | TYPE * | type = 0 | ) |

| If caller has passed us a non-NULL ts_obj *, then we'll just use this to initialize the thread-specific value (but only for the calling thread). Thus, subsequent calls to <operator->> in this thread will return this value. This is useful since it enables us to assign objects to thread-specific data that have arbitrarily complex constructors.

template<class TYPE>
ACE_TSS< TYPE >::~ACE_TSS | ( | void |  | ) | `[virtual]`

| Deregister with thread-key administration.

template<class TYPE>
ACE_TSS< TYPE >::ACE_TSS | ( | const ACE_TSS< TYPE > & |  | ) | `[protected]`

## Member Function Documentation

template<class TYPE>
void ACE_TSS< TYPE >::dump | ( | void |  | ) | const

| Dump the state of an object.

template<class TYPE>
TYPE * ACE_TSS< TYPE >::make_TSS_TYPE | ( | void |  | ) | const`[virtual]`

| Hook for construction parameters.

template<class TYPE>
ACE_TSS< TYPE >::operator TYPE * | ( | void |  | ) | const

| Return or create and return the calling threads TYPE object.

template<class TYPE>
TYPE * ACE_TSS< TYPE >::operator-> | ( | void |  | ) | const

| Use a "smart pointer" to get the thread-specific object associated with the <key_>.

template<class TYPE>
void ACE_TSS< TYPE >::operator= | ( | const ACE_TSS< TYPE > & |  | ) | `[protected]`

template<class TYPE>
ACE_INLINE TYPE * ACE_TSS< TYPE >::ts_get | ( | void |  | ) | const`[protected]`

| Actually implements the code that retrieves the object from thread-specific storage.

template<class TYPE>
ACE_INLINE int ACE_TSS< TYPE >::ts_init | ( | void |  | ) | const`[protected]`

| Factors out common code for initializing TSS. This must NOT be called with the lock held...

template<class TYPE>
ACE_INLINE TYPE * ACE_TSS< TYPE >::ts_object | ( | TYPE * | type | ) |

| Set the thread-specific object for the key associated with this object.

template<class TYPE>
ACE_INLINE TYPE * ACE_TSS< TYPE >::ts_object | ( | void |  | ) | const

| Get the thread-specific object for the key associated with this object. Returns 0 if the data has never been initialized, otherwise returns a pointer to the data.

## Member Data Documentation

template<class TYPE>
TYPE* ACE_TSS::type_`[protected]`

| This implementation only works for non-threading systems...

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

- Synch_T.h
- Synch_T.cpp
- Synch_T.i