9 #ifndef _LOG4CPP_THREADING_PTHREADS_HH 10 #define _LOG4CPP_THREADING_PTHREADS_HH 30 pthread_mutex_t mutex;
34 ::pthread_mutex_init(&mutex, NULL);
38 ::pthread_mutex_lock(&mutex);
42 ::pthread_mutex_unlock(&mutex);
46 ::pthread_mutex_destroy(&mutex);
74 template <
typename T>
class ThreadLocalDataHolder {
87 delete reinterpret_cast<T*
>(p);
95 ::pthread_key_delete(_key);
98 inline T*
get()
const {
99 return reinterpret_cast<T*
>(::pthread_getspecific(_key));
111 ::pthread_setspecific(_key, NULL);
121 ::pthread_setspecific(_key, p);
~ThreadLocalDataHolder()
Definition: PThreads.hh:90
T data_type
Definition: PThreads.hh:79
static void freeHolder(void *p)
Definition: PThreads.hh:85
~Mutex()
Definition: PThreads.hh:45
definition of ScopedLock;
Definition: PThreads.hh:57
void lock()
Definition: PThreads.hh:37
void unlock()
Definition: PThreads.hh:41
ThreadLocalDataHolder()
Definition: PThreads.hh:81
T * release()
Definition: PThreads.hh:109
The top level namespace for all 'Log for C++' types and classes.
Definition: AbortAppender.hh:16
Mutex()
Definition: PThreads.hh:33
void reset(T *p=NULL)
Definition: PThreads.hh:116
T * operator->() const
Definition: PThreads.hh:102
static std::string getThreadId()
Return an identifier for the current thread.
Definition: BoostThreads.hh:22
Definition: PThreads.hh:28
ScopedLock(Mutex &mutex)
Definition: PThreads.hh:62
~ScopedLock()
Definition: PThreads.hh:66
T & operator*() const
Definition: PThreads.hh:105