Thread-local storage smart pointer. More...
#include <ThreadLocal.h++>

Public Member Functions | |
| ThreadLocal () throw (SystemException) | |
| Construct a new ThreadLocal object. | |
| virtual | ~ThreadLocal () throw () |
| Destructor. | |
| T & | operator* () throw (NullPointerException) |
| Pointer-dereference operator. | |
| T * | operator-> () throw (NullPointerException) |
| Pointer operator. | |
| void | setValue (T *value) throw () |
| Set the value of the thread-local object for the calling thread. | |
| T * | getValue () throw () |
| Get the value of the thread-local object for the calling thread. | |
Static Public Member Functions | |
| static int | getSlotCount () |
| Get the maximum number of thread-local storage slots available on this platform. | |
Protected Member Functions | |
| virtual T * | initialValue () |
| Provide the intial value of the thread-local object for the calling thread. | |
Thread-local storage smart pointer.
This template provides a mechanism for creating an object that has a distinct value for each thread that accesses it. The template parameter T is the type of thread-local object being created. Subclasses should override the initialValue() method to provide an initial value for the object.
| ThreadLocal | ( | ) | throw (SystemException) |
Construct a new ThreadLocal object.
| SystemException | If a system-level error occurred. |
| virtual ~ThreadLocal | ( | ) | throw () [virtual] |
Destructor.
Note that the destructor only deallocates system resources associated with the thread-local storage slot, not the actual values stored in that slot. Each thread should destroy its instance of the thread-local object when it is no longer needed.
| static int getSlotCount | ( | ) | [static] |
Get the maximum number of thread-local storage slots available on this platform.
A return value of -1 indicates that there is no limit.
| T* getValue | ( | ) | throw () |
Get the value of the thread-local object for the calling thread.
| virtual T* initialValue | ( | ) | [protected, virtual] |
Provide the intial value of the thread-local object for the calling thread.
The default implementation returns NULL.
Reimplemented in JavaThreadLocalBuffer, ThreadLocalBuffer< T >, and ThreadLocalCounter.
| T& operator* | ( | ) | throw (NullPointerException) |
Pointer-dereference operator.
| NullPointerException | If the value of the object was never initialized for the calling thread. |
| T* operator-> | ( | ) | throw (NullPointerException) |
Pointer operator.
| NullPointerException | If the value of the object was never initialized for the calling thread. |
| void setValue | ( | T * | value | ) | throw () |
Set the value of the thread-local object for the calling thread.
| value | The new value. |
1.6.3