9 #ifndef _LOG4CPP_THREADING_PTHREADS_HH 10 #define _LOG4CPP_THREADING_PTHREADS_HH 31 pthread_mutex_t mutex;
35 ::pthread_mutex_init(&mutex, NULL);
39 ::pthread_mutex_lock(&mutex);
43 ::pthread_mutex_unlock(&mutex);
47 ::pthread_mutex_destroy(&mutex);
84 ::pthread_key_create(&_key, freeHolder);
89 delete reinterpret_cast<T *
>(p);
97 ::pthread_key_delete(_key);
100 inline T*
get()
const {
101 return reinterpret_cast<T *
>(::pthread_getspecific(_key));
109 ::pthread_setspecific(_key, NULL);
119 ::pthread_setspecific(_key, p);
This class holds Thread local data of type T, i.e.
Definition: BoostThreads.hh:32
~ThreadLocalDataHolder()
Definition: PThreads.hh:92
T data_type
Definition: PThreads.hh:81
static void freeHolder(void *p)
Definition: PThreads.hh:87
~Mutex()
Definition: PThreads.hh:46
definition of ScopedLock;
Definition: PThreads.hh:58
void lock()
Definition: PThreads.hh:38
void unlock()
Definition: PThreads.hh:42
ThreadLocalDataHolder()
Definition: PThreads.hh:83
T * release()
Definition: PThreads.hh:107
The top level namespace for all 'Log for C++' types and classes.
Definition: AbortAppender.hh:16
Mutex()
Definition: PThreads.hh:34
void reset(T *p=NULL)
Definition: PThreads.hh:114
T * operator->() const
Definition: PThreads.hh:104
static std::string getThreadId()
Return an identifier for the current thread.
Definition: BoostThreads.hh:22
Definition: PThreads.hh:29
ScopedLock(Mutex &mutex)
Definition: PThreads.hh:63
~ScopedLock()
Definition: PThreads.hh:68
T & operator*() const
Definition: PThreads.hh:105