#include <TSS_T.h>
Collaboration diagram for ACE_TSS< TYPE >:
Public Member Functions | |
ACE_TSS (TYPE *ts_obj=0) | |
virtual | ~ACE_TSS (void) |
Deregister with thread-key administration. | |
TYPE * | ts_object (void) const |
TYPE * | ts_object (TYPE *) |
TYPE * | operator-> () const |
operator TYPE * (void) const | |
Return or create and return the calling threads TYPE object. | |
virtual TYPE * | make_TSS_TYPE (void) const |
Hook for construction parameters. | |
void | dump (void) const |
Dump the state of an object. | |
Protected Member Functions | |
TYPE * | ts_get (void) const |
int | ts_init (void) |
void | operator= (const ACE_TSS< TYPE > &) |
ACE_TSS (const ACE_TSS< TYPE > &) | |
Protected Attributes | |
TYPE * | type_ |
This implementation only works for non-threading systems... |
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.
Beware when creating static instances of this type (as with any other, btw). The unpredictable order of initialization across different platforms may cause a situation where you'd use the instance, before it is fully initialized. That's why typically instances of this type are dynamicaly allocated. On the stack it is typically allocated inside the ACE_Thread::svc() method which limits its lifetime appropriately.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_TSS< TYPE >::ACE_TSS | ( | TYPE * | ts_obj = 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.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_TSS< TYPE >::~ACE_TSS | ( | void | ) | [virtual] |
Deregister with thread-key administration.
void ACE_TSS< TYPE >::dump | ( | void | ) | const |
TYPE * ACE_TSS< TYPE >::make_TSS_TYPE | ( | void | ) | const [virtual] |
ACE_TSS< TYPE >::operator TYPE * | ( | void | ) | const |
Return or create and return the calling threads TYPE object.
TYPE * ACE_TSS< TYPE >::operator-> | ( | ) | const |
Use a "smart pointer" to get the thread-specific object associated with the <key_>.
ACE_INLINE TYPE * ACE_TSS< TYPE >::ts_get | ( | void | ) | const [protected] |
Actually implements the code that retrieves the object from thread-specific storage.
ACE_INLINE int ACE_TSS< TYPE >::ts_init | ( | void | ) | [protected] |
Factors out common code for initializing TSS. This must NOT be called with the lock held...
ACE_INLINE TYPE * ACE_TSS< TYPE >::ts_object | ( | TYPE * | ) |
Set the thread-specific object for the key associated with this object.
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.
This implementation only works for non-threading systems...