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);
76 template<
typename T>
class ThreadLocalDataHolder {
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);