class ThreadKey

container for thread specific data storage. More...

Full nameost::ThreadKey
Definition#include <thread.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

This class allows the creation of a thread context unique "pointer" that can be set and retrieved and can be used to create thread specific data areas for implementing "thread safe" library routines.

Finally, Common C++ supports a thread-safe "AtomicCounter" class. This can often be used for reference counting without having to protect the counter with a separate Mutex counter. This lends to lighter-weight code.

 ThreadKey ()

ThreadKey

Create a unique thread specific container.

 ~ThreadKey ()

~ThreadKey

[virtual]

Destroy a thread specific container and any contents reserved.

void * getKey (void)

getKey

Get the value of the pointer for the thread specific data container. A unique pointer can be set for each execution context.

Returns: a unique void * for each execution context.

void  setKey (void *)

setKey

Set the value of the pointer for the current thread specific execution context. This can be used to store thread context specific data.

Parameters:
ptrto thread context specific data.