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

Public Member Functions | |
| ThreadLocal () | |
| Construct a new ThreadLocal object. More... | |
| virtual | ~ThreadLocal () |
| Destructor. More... | |
| T & | operator* () |
| Pointer-dereference operator. More... | |
| T * | operator-> () |
| Pointer operator. More... | |
| void | setValue (T *value) |
| Set the value of the thread-local object for the calling thread. More... | |
| T * | getValue () |
| Get the value of the thread-local object for the calling thread. More... | |
Static Public Member Functions | |
| static int | getSlotCount () |
| Get the maximum number of thread-local storage slots available on this platform. More... | |
Protected Member Functions | |
| virtual T * | initialValue () |
| Provide the intial value of the thread-local object for the calling thread. More... | |
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 | ( | ) |
Construct a new ThreadLocal object.
| SystemException | If a system-level error occurred. |
|
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 |
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 | ( | ) |
Get the value of the thread-local object for the calling thread.
|
protectedvirtual |
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* | ( | ) |
Pointer-dereference operator.
| NullPointerException | If the value of the object was never initialized for the calling thread. |
| T* operator-> | ( | ) |
Pointer operator.
| NullPointerException | If the value of the object was never initialized for the calling thread. |
| void setValue | ( | T * | value | ) |
Set the value of the thread-local object for the calling thread.
| value | The new value. |