Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ACE_TSS_Cleanup Class Reference

Singleton that helps to manage the lifetime of TSS objects and keys. More...

Collaboration diagram for ACE_TSS_Cleanup:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ~ACE_TSS_Cleanup (void)
int insert (ACE_thread_key_t key, void(*destructor)(void *), void *inst)
void thread_use_key (ACE_thread_key_t key)
 Mark a key as being used by this thread.
int thread_free_key (ACE_thread_key_t key, void *inst)
void thread_exit (void)

Static Public Member Functions

ACE_TSS_Cleanupinstance (void)
int lockable ()

Private Types

typedef ACE_TSS_Info ACE_TSS_TABLE [ACE_DEFAULT_THREAD_KEYS]
typedef ACE_TSS_InfoACE_TSS_TABLE_ITERATOR

Private Member Functions

void dump (void)
int free_key (ACE_thread_key_t key)
 Perform the actual free actions for thread_free_key and thread_exit.
void remove_key (ACE_TSS_Info &info)
void thread_release (ACE_TSS_Info &info, ACE_TSS_Info::Destructor &destructor, void *&tss_obj)
bool find_tss_keys (ACE_TSS_Keys *&thread_keys) const
ACE_TSS_Keystss_keys ()
 ACE_TSS_Cleanup (void)
 Ensure singleton.

Private Attributes

ACE_TSS_TABLE table_
 Table of <ace_tss_info>'s.
ACE_thread_key_t in_use_

Static Private Attributes

ACE_TSS_Cleanupinstance_ = 0
 Pointer to the singleton instance.

Detailed Description

Singleton that helps to manage the lifetime of TSS objects and keys.


Member Typedef Documentation

typedef ACE_TSS_Info ACE_TSS_Cleanup::ACE_TSS_TABLE[ACE_DEFAULT_THREAD_KEYS] [private]
 

typedef ACE_TSS_Info* ACE_TSS_Cleanup::ACE_TSS_TABLE_ITERATOR [private]
 


Constructor & Destructor Documentation

ACE_TSS_Cleanup::~ACE_TSS_Cleanup void   ) 
 

ACE_TSS_Cleanup::ACE_TSS_Cleanup void   )  [private]
 

Ensure singleton.


Member Function Documentation

void ACE_TSS_Cleanup::dump void   )  [private]
 

bool ACE_TSS_Cleanup::find_tss_keys ACE_TSS_Keys *&  thread_keys  )  const [private]
 

Find the TSS keys (if any) for this thread.

Parameters:
thread_keys reference to pointer to be filled in by this function.
Returns:
false if keys don't exist.

int ACE_TSS_Cleanup::free_key ACE_thread_key_t  key  )  [private]
 

Perform the actual free actions for thread_free_key and thread_exit.

int ACE_TSS_Cleanup::insert ACE_thread_key_t  key,
void(*)(void *)  destructor,
void *  inst
 

Register a newly-allocated key

Parameters:
key the key to be monitored
destructor the function to call to delete objects stored via this key
inst an opaque value used to reserve this key. If inst is zero then the key is freed when the thread-use count goes to zero.

ACE_TSS_Cleanup * ACE_TSS_Cleanup::instance void   )  [static]
 

int ACE_TSS_Cleanup::lockable  )  [inline, static]
 

Indication of whether the ACE_TSS_CLEANUP_LOCK is usable, and therefore whether we are in static constructor/destructor phase or not.

void ACE_TSS_Cleanup::remove_key ACE_TSS_Info info  )  [private]
 

remove key if it's unused (thread_count == 0 and inst == 0)

Parameters:
info reference to the info for this key

void ACE_TSS_Cleanup::thread_exit void   ) 
 

Cleanup the thread-specific objects. Does _NOT_ exit the thread. For each used key perform the same actions as thread_free_key.

int ACE_TSS_Cleanup::thread_free_key ACE_thread_key_t  key,
void *  inst
 

This thread is no longer using this key Deletes the TSS object associated with this thread/key. Clears reservation if inst != 0. Release key if use count == 0 and reservation is cleared.

Parameters:
key the key to be released
inst a opaque value. If it is non-zero, it must match the inst value given to insert and the key will no longer be reserved.

void ACE_TSS_Cleanup::thread_release ACE_TSS_Info info,
ACE_TSS_Info::Destructor destructor,
void *&  tss_obj
[private]
 

Release a key used by this thread

Parameters:
info reference to the info for this key
destructor out arg to receive destructor function ptr
tss_obj out arg to receive pointer to deletable object

void ACE_TSS_Cleanup::thread_use_key ACE_thread_key_t  key  ) 
 

Mark a key as being used by this thread.

ACE_TSS_Keys * ACE_TSS_Cleanup::tss_keys  )  [private]
 

Accessor for this threads ACE_TSS_Keys instance. Creates the keys if necessary.


Member Data Documentation

ACE_thread_key_t ACE_TSS_Cleanup::in_use_ [private]
 

Key for the thread-specific ACE_TSS_Keys Used by find_tss_keys() or tss_keys() to find the bit array that records whether each TSS key is in use by this thread.

ACE_TSS_Cleanup * ACE_TSS_Cleanup::instance_ = 0 [static, private]
 

Pointer to the singleton instance.

ACE_TSS_TABLE ACE_TSS_Cleanup::table_ [private]
 

Table of <ace_tss_info>'s.


The documentation for this class was generated from the following file:
Generated on Thu Feb 10 20:36:52 2005 for ACE by  doxygen 1.3.9.1