Main Page Namespace List Class Hierarchy Compound List Compound Members

# ZThread::AbstractThreadLocal Class Reference

`#include <AbstractThreadLocal.h>`

Inheritance diagram for ZThread::AbstractThreadLocal::

List of all members.

## Public Methods
| AbstractThreadLocal () throw ()
virtual | ~AbstractThreadLocal () throw ()
## Protected Methods
virtual void* | initialValue (void *)=0 throw ()
virtual void* | childValue (void *parentValue) throw ()
virtual bool | propogateValue ()=0 throw ()
void* | fetch () const throw (Synchronization_Exception)
void* | get () const throw (Synchronization_Exception)
void* | set (void *) const throw (Synchronization_Exception)

## Detailed Description

Author:
  Eric Crahen

Version:
  1.3.5

Date:
  04-22-2001

This class implements a common set of functionality for thread specific value classes. By default, on most systems, the native libraries only provide support for void* value and no support for inhertiable or initial value setting.

This class implements the minimum set of functionality needed to provide more specific, and strongly typed support than is otherwise available.

NOTE: Any AbstractThreadLocal MUST be a static variable. This allows for the fastest and most logical use of thread sepcific variables. In addition, it is not worth the extra overhead involved with keeping track of variables that may go out of scope of be deteled from one thread while others are using. While this would be possible, there is a speed tradeoff & a strange relationship between a thread and ThreadLocal variables that might disappear. It seems a little too awkawrd with very little, if any, benefit to use these variables in that way.

See also:
  ThreadLocal , InheritableThreadLocal , FastThreadLocal

## Constructor & Destructor Documentation

AbstractThreadLocal ( | ) throw ()

| Create a newAbstractThreadLocal object

~AbstractThreadLocal ( | ) throw ()`[virtual]`

| Destroy this AbstractThreadLocal object

## Member Function Documentation

void * childValue ( | void * parentValue ) throw ()`[inline, protected, virtual]`

  | Invoked by the framework whenever a per/thread, or thread-specfic initialization is required. Parameters:
  void | * - related initialization value
  Parameters:
  parentValue |
Reimplemented in ZThread::InheritableThreadLocal.

void * fetch ( | ) const throw (Synchronization_Exception)`[protected]`

  | Get a value with thisAbstractThreadLocal object. Any value retrieved from this object will have been set from the same Thread. No initilization is performed with this function. Exceptions:
  Synchronization_Exception | - thrown if there is an error allocating native thread local storage

void * get ( | ) const throw (Synchronization_Exception)`[protected]`

  | Get a value with thisAbstractThreadLocal object. Any value retrieved from this object will have been set from the same Thread. Causes initialize() to be called if appropriate. Exceptions:
  Synchronization_Exception | - thrown if there is an error allocating native thread local storage
Reimplemented in ZThread::FastThreadLocal, and ZThread::ThreadLocal.

void * initialValue ( | void * initValue ) throw ()`[protected, pure virtual]`

  | Invoked by the framework whenever a per/thread, or thread-specfic initialization is required. Parameters:
  void | * - related initialization value
  Parameters:
  initValue |
Reimplemented in ZThread::FastThreadLocal, and ZThread::ThreadLocal.

bool propogateValue ( | ) throw ()`[protected, pure virtual]`

  | Invoked by the framework whenever it needs to be determined wether or not this value should propogate to child threads. Parameters:
  bool | - true if this value should propgate
Reimplemented in ZThread::FastThreadLocal, ZThread::InheritableThreadLocal, and ZThread::ThreadLocal.

void * set ( | void * ) const throw (Synchronization_Exception)`[protected]`

  | Set a value with this AbstractThreadLocal object. This value can only be retrieved from this AbstractThreadLocal object from the same Thread that set it. Exceptions:
  Synchronization_Exception | - thrown if there is an error allocating native thread local storage

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

- AbstractThreadLocal.h