NAME

ACE_TSS - 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.

SYNOPSIS

#include <ace/Synch_T.h>

template<class TYPE> class ACE_TSS { public: ACE_TSS (TYPE *ts_obj = 0); virtual ~ACE_TSS (void); TYPE *ts_object (void) const; TYPE *ts_object (TYPE *); TYPE *operator-> () const; operator TYPE *(void) const; virtual TYPE *make_TSS_TYPE (void) const; void dump (void) const; protected: TYPE *ts_get (void) const; int ts_init (void) const; TYPE *type_; ACE_Thread_Mutex keylock_; int once_; ACE_thread_key_t key_; static void cleanup (void *ptr); inline ACE_UNIMPLEMENTED_FUNC ( void operator= (const ACE_TSS<TYPE> &) ); };

DESCRIPTION

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: TYPE cannot be a built-in type, but instead must be a user-defined class. (Some compilers will allow a built-in type, but shouldn't. Sun C++ won't, properly detecting the improper return type from operator->.) See template class ACE_TSS_Type_Adapter, below, for adapting built-in types to work with ACE_TSS.

Initialization and termination methods.

ACE_TSS (TYPE *ts_obj = 0);

virtual ~ACE_TSS (void);

Accessors.

TYPE *ts_object (void) const;

TYPE *ts_object (TYPE *);

TYPE *operator-> () const;

operator TYPE *(void) const;

virtual TYPE *make_TSS_TYPE (void) const;

Utility methods.

void dump (void) const;

ACE_ALLOC_HOOK_DECLARE; Declare the dynamic allocation hooks.

Disallow copying...

inline ACE_UNIMPLEMENTED_FUNC (
    void operator= (const ACE_TSS<TYPE> &)
    );

AUTHOR

Doug Schmidt

LIBRARY

ace