libcommonc++  0.7
ThreadLocalCounter Class Reference

Thread-local numeric counter. More...

#include <ThreadLocalCounter.h++>

Inheritance diagram for ThreadLocalCounter:
Collaboration diagram for ThreadLocalCounter:

Public Member Functions

 ThreadLocalCounter ()
 Construct a new ThreadLocalCounter with an initial value of 0. More...
 
virtual ~ThreadLocalCounter ()
 Destructor. More...
 
int32_t & operator* ()
 Pointer-dereference operator. More...
 
int32_t * operator-> ()
 Pointer operator. More...
 
void setValue (int32_t *value)
 Set the value of the thread-local object for the calling thread. More...
 
int32_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

int32_t * initialValue ()
 Provide the intial value of the thread-local object for the calling thread. More...
 

Detailed Description

Thread-local numeric counter.

The counter exists as a separate instance for each calling thread.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ ThreadLocalCounter()

Construct a new ThreadLocalCounter with an initial value of 0.

◆ ~ThreadLocalCounter()

~ThreadLocalCounter ( )
virtual

Destructor.

Member Function Documentation

◆ getSlotCount()

static int getSlotCount ( )
staticinherited

Get the maximum number of thread-local storage slots available on this platform.

A return value of -1 indicates that there is no limit.

◆ getValue()

int32_t * getValue ( )
inherited

Get the value of the thread-local object for the calling thread.

Returns
The current (possibly NULL) value.

◆ initialValue()

int32_t * initialValue ( )
protectedvirtual

Provide the intial value of the thread-local object for the calling thread.

The default implementation returns NULL.

Returns
The initial value.

Reimplemented from ThreadLocal< int32_t >.

◆ operator*()

int32_t & operator* ( )
inherited

Pointer-dereference operator.

Returns
A reference to the thread-local object.
Exceptions
NullPointerExceptionIf the value of the object was never initialized for the calling thread.

◆ operator->()

int32_t * operator-> ( )
inherited

Pointer operator.

Returns
A pointer to the thread-local object.
Exceptions
NullPointerExceptionIf the value of the object was never initialized for the calling thread.

◆ setValue()

void setValue ( int32_t *  value)
inherited

Set the value of the thread-local object for the calling thread.

Parameters
valueThe new value.

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