cheshirekow  v0.1.0
pthreads::Key Class Reference

A key is an identifier used to specify a storage location where the thing stored is different for each thread. More...

#include <cpp_pthreads/key.h>

Public Types

typedef void(* Destructor_t )(void *)
 type of a function which is used to destroy the object if the object is not null when the key is destroyed More...
 

Public Member Functions

int create (Destructor_t destruct=0)
 create a key that can be used to identify per-thread specific objects More...
 
int destroy ()
 destroy the key, call destructor on data if it is set and data is not null More...
 
void * getSpecific ()
 return the data associated with this key that belongs to this thread More...
 
int setSpecific (void *value)
 set this threads data in the box associated with this key More...
 

Private Attributes

pthread_key_t m_data
 

Detailed Description

A key is an identifier used to specify a storage location where the thing stored is different for each thread.

Definition at line 36 of file key.h.

Member Typedef Documentation

typedef void(* pthreads::Key::Destructor_t)(void *)

type of a function which is used to destroy the object if the object is not null when the key is destroyed

Definition at line 40 of file key.h.

Member Function Documentation

int pthreads::Key::create ( Destructor_t  destruct = 0)

create a key that can be used to identify per-thread specific objects

Parameters
destructdestructor which is called on any non-null data when this key is destroyed
int pthreads::Key::destroy ( )

destroy the key, call destructor on data if it is set and data is not null

void* pthreads::Key::getSpecific ( )

return the data associated with this key that belongs to this thread

int pthreads::Key::setSpecific ( void *  value)

set this threads data in the box associated with this key

Member Data Documentation

pthread_key_t pthreads::Key::m_data
private

Definition at line 43 of file key.h.


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