Google

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ThreadKey Class Reference

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. container for thread specific data storage. More...

#include <thread.h>

List of all members.

Public Methods

 ThreadKey ()
 Create a unique thread specific container.

 ~ThreadKey ()
 Destroy a thread specific container and any contents reserved.

void* getKey (void)
 Get the value of the pointer for the thread specific data container. More...

void setKey (void *)
 Set the value of the pointer for the current thread specific execution context. More...


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. container for thread specific data storage.

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.

Author(s):
David Sugar <dyfet@ostel.com>


Constructor & Destructor Documentation

ThreadKey::ThreadKey ( )
 

Create a unique thread specific container.

ThreadKey::~ThreadKey ( )
 

Destroy a thread specific container and any contents reserved.


Member Function Documentation

void * ThreadKey::getKey ( void )
 

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 ThreadKey::setKey ( void * )
 

Set the value of the pointer for the current thread specific execution context.

This can be used to store thread context specific data.

Parameters:
ptr   to thread context specific data.


The documentation for this class was generated from the following file:
Generated at Fri Mar 23 10:47:57 2001 for CommonC++ by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000