proxygen
PThreadGetSpecific< T > Class Template Reference

Public Member Functions

 PThreadGetSpecific ()
 
Tget () const
 
void reset (T *t)
 

Static Public Member Functions

static void OnThreadExit (void *obj)
 

Private Attributes

pthread_key_t key_
 

Detailed Description

template<typename T>
class PThreadGetSpecific< T >

Definition at line 40 of file ThreadLocalBenchmark.cpp.

Constructor & Destructor Documentation

template<typename T >
PThreadGetSpecific< T >::PThreadGetSpecific ( )
inline

Definition at line 42 of file ThreadLocalBenchmark.cpp.

42  : key_(0) {
43  pthread_key_create(&key_, OnThreadExit);
44  }
static void OnThreadExit(void *obj)

Member Function Documentation

template<typename T >
T* PThreadGetSpecific< T >::get ( ) const
inline

Definition at line 46 of file ThreadLocalBenchmark.cpp.

References folly::T.

46  {
47  return static_cast<T*>(pthread_getspecific(key_));
48  }
#define T(v)
Definition: http_parser.c:233
template<typename T >
static void PThreadGetSpecific< T >::OnThreadExit ( void *  obj)
inlinestatic

Definition at line 54 of file ThreadLocalBenchmark.cpp.

References folly::T.

54  {
55  delete static_cast<T*>(obj);
56  }
#define T(v)
Definition: http_parser.c:233
template<typename T >
void PThreadGetSpecific< T >::reset ( T t)
inline

Definition at line 50 of file ThreadLocalBenchmark.cpp.

50  {
51  delete get();
52  pthread_setspecific(key_, t);
53  }

Member Data Documentation

template<typename T >
pthread_key_t PThreadGetSpecific< T >::key_
private

Definition at line 59 of file ThreadLocalBenchmark.cpp.


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