Go to the documentation of this file.
28 #ifndef _LOG4TANGO_THREADING_PTHREADS_H
29 #define _LOG4TANGO_THREADING_PTHREADS_H
51 pthread_mutex_t mutex;
56 ::pthread_mutex_init(&mutex, NULL);
60 ::pthread_mutex_destroy(&mutex);
64 ::pthread_mutex_lock(&mutex);
68 ::pthread_mutex_unlock(&mutex);
108 int lock (
long timeout_ = 0);
128 long recursion_level_;
141 #ifdef LOG4TANGO_HAS_NDC
142 template<
typename T>
class ThreadLocalDataHolder {
150 inline ThreadLocalDataHolder() {
151 ::pthread_key_create(&_key, freeHolder);
154 inline static void freeHolder(
void *p) {
156 delete reinterpret_cast<T *
>(p);
159 inline ~ThreadLocalDataHolder() {
164 ::pthread_key_delete(_key);
167 inline T* get()
const {
168 return reinterpret_cast<T *
>(::pthread_getspecific(_key));
171 inline T* operator->()
const {
return get(); }
172 inline T& operator*()
const {
return *get(); }
174 inline T* release() {
176 ::pthread_setspecific(_key, NULL);
180 inline void reset(T* p = NULL) {
185 ::pthread_setspecific(_key, p);
188 #endif //LOG4TANGO_HAS_NDC
194 #endif // _LOG4TANGO_THREADING_PTHREADS_H
~RecursiveMutex(void)
Definition: MSThreads.hh:132
int lock(long timeout_=0)
Definition: MSThreads.hh:142
Definition: MSThreads.hh:74
int Mutex
Definition: DummyThreads.hh:41
Definition: MSThreads.hh:123
Definition: Appender.hh:40
void lock()
Definition: PThreads.hh:63
Mutex()
Definition: PThreads.hh:55
void unlock(void)
Definition: MSThreads.hh:153
pthread_mutex_t guard_
Definition: PThreads.hh:120
~Mutex()
Definition: PThreads.hh:59
void unlockn(void)
Definition: MSThreads.hh:159
pthread_cond_t mutex_available_
Definition: PThreads.hh:124
RecursiveMutex(void)
Definition: MSThreads.hh:127
std::string get_thread_id(void)
Definition: DummyThreads.cpp:37
void unlock()
Definition: PThreads.hh:67
ScopedLock(Mutex &m)
Definition: PThreads.hh:81
~ScopedLock()
Definition: PThreads.hh:85
int ScopedLock
Definition: DummyThreads.hh:43