28#ifndef _LOG4TANGO_THREADING_MSTHREADS_H
29#define _LOG4TANGO_THREADING_MSTHREADS_H
42# define LOG4TANGO_UNDEFINE_NOGDI
45# ifndef WIN32_LEAN_AND_MEAN
46# define WIN32_LEAN_AND_MEAN
47# define LOG4TANGO_UNDEFINE_WIN32_LEAN_AND_MEAN
52# ifdef LOG4TANGO_UNDEFINE_NOGDI
56# ifdef LOG4TANGO_UNDEFINE_WIN32_LEAN_AND_MEAN
57# undef WIN32_LEAN_AND_MEAN
79 InitializeCriticalSection(&_criticalSection);
83 DeleteCriticalSection(&_criticalSection);
87 return &_criticalSection;
94 CRITICAL_SECTION _criticalSection;
106 EnterCriticalSection(_criticalSection);
110 LeaveCriticalSection(_criticalSection);
117 LPCRITICAL_SECTION _criticalSection;
128 ::InitializeCriticalSection(&
guard_);
133 ::DeleteCriticalSection(&
guard_);
142 inline int lock (
long timeout_ = 0) {
143 ::EnterCriticalSection(&
guard_);
156 ::LeaveCriticalSection(&
guard_);
161 while (recursion_level_ > 0) {
163 ::LeaveCriticalSection(&
guard_);
173 unsigned long recursion_level_;
189#ifdef LOG4TANGO_HAS_NDC
190template<
typename T>
class ThreadLocalDataHolder
194 inline ThreadLocalDataHolder()
198 inline ~ThreadLocalDataHolder() {
207 inline T* get (
void)
const {
208 return (T*)TlsGetValue(_key);
217 inline T* operator->()
const {
226 inline T& operator*()
const {
236 inline T* release() {
237 T* result = (T*)TlsGetValue(_key);
238 TlsSetValue(_key, NULL);
248 inline void reset(T* p = NULL) {
249 T* thing = (T*)TlsGetValue(_key);
251 TlsSetValue(_key, p);
#define LOG4TANGO_EXPORT
Definition: Export.hh:38
Definition: MSThreads.hh:75
Mutex()
Definition: MSThreads.hh:78
LPCRITICAL_SECTION get_critical_section(void)
Definition: MSThreads.hh:86
~Mutex()
Definition: MSThreads.hh:82
Definition: MSThreads.hh:124
void unlock(void)
Definition: MSThreads.hh:153
~RecursiveMutex(void)
Definition: MSThreads.hh:132
RecursiveMutex(void)
Definition: MSThreads.hh:127
int lock(long timeout_=0)
Definition: MSThreads.hh:142
CRITICAL_SECTION guard_
Definition: MSThreads.hh:169
void unlockn(void)
Definition: MSThreads.hh:159
Definition: MSThreads.hh:101
ScopedLock(Mutex &mutex)
Definition: MSThreads.hh:104
~ScopedLock()
Definition: MSThreads.hh:109
int Mutex
Definition: DummyThreads.hh:41
std::string get_thread_id(void)
Definition: DummyThreads.cpp:37
Definition: Appender.hh:40