#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> &) );
};
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.
ACE_TSS (TYPE *ts_obj = 0);
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.
virtual ~ACE_TSS (void);
TYPE *ts_object (void) const;
TYPE *ts_object (TYPE *);
TYPE *operator-> () const;
key_
.
operator TYPE *(void) const;
virtual TYPE *make_TSS_TYPE (void) const;
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE; Declare the dynamic allocation hooks.
inline ACE_UNIMPLEMENTED_FUNC (
void operator= (const ACE_TSS<TYPE> &)
);