10 #ifndef _LOG4CPP_THREADING_MSTHREADS_HH 11 #define _LOG4CPP_THREADING_MSTHREADS_HH 20 #define NOGDI // this will circumvent the ERROR #define in windows.h 21 #define LOG4CPP_UNDEFINE_NOGDI 24 #ifndef WIN32_LEAN_AND_MEAN 25 #define WIN32_LEAN_AND_MEAN 26 #define LOG4CPP_UNDEFINE_WIN32_LEAN_AND_MEAN 31 #ifdef LOG4CPP_UNDEFINE_NOGDI 35 #ifdef LOG4CPP_UNDEFINE_WIN32_LEAN_AND_MEAN 36 #undef WIN32_LEAN_AND_MEAN 39 #endif // done dealing with ERROR #define 56 InitializeCriticalSection(&_criticalSection);
59 DeleteCriticalSection(&_criticalSection);
62 return &_criticalSection;
67 CRITICAL_SECTION _criticalSection;
73 typedef MSMutex
Mutex;
83 EnterCriticalSection(_criticalSection);
87 LeaveCriticalSection(_criticalSection);
92 LPCRITICAL_SECTION _criticalSection;
107 template <
typename T>
class ThreadLocalDataHolder {
120 inline T*
get()
const {
121 return (T*)TlsGetValue(_key);
150 T* result = (T*)TlsGetValue(_key);
151 TlsSetValue(_key, NULL);
162 T* thing = (T*)TlsGetValue(_key);
164 TlsSetValue(_key, p);
~ThreadLocalDataHolder()
Definition: MSThreads.hh:111
MSScopedLock(MSMutex &mutex)
Definition: MSThreads.hh:81
A simple object wrapper around WaitForSingleObject() and ReleaseMutex()
Definition: MSThreads.hh:79
ThreadLocalDataHolder()
Definition: MSThreads.hh:109
T * release()
Releases the Object held for the current thread.
Definition: MSThreads.hh:149
#define LOG4CPP_EXPORT
Definition: Export.hh:26
The top level namespace for all 'Log for C++' types and classes.
Definition: AbortAppender.hh:16
boost::mutex Mutex
Dummy type 'int' for Mutex.
Definition: BoostThreads.hh:27
void reset(T *p=NULL)
Sets a new Object to be held for the current thread.
Definition: MSThreads.hh:161
MSMutex()
Definition: MSThreads.hh:55
T * operator->() const
Obtains the Object held for the current thread.
Definition: MSThreads.hh:130
static std::string getThreadId()
Return an identifier for the current thread.
Definition: BoostThreads.hh:22
A simple object wrapper around CreateMutex() and DeleteMutex()
Definition: MSThreads.hh:53
boost::mutex::scoped_lock ScopedLock
Dummy type 'int' defintion of ScopedLock;.
Definition: BoostThreads.hh:30
~MSScopedLock()
Definition: MSThreads.hh:86
LPCRITICAL_SECTION getCriticalSection()
Definition: MSThreads.hh:61
~MSMutex()
Definition: MSThreads.hh:58
T & operator*() const
Obtains the Object held for the current thread.
Definition: MSThreads.hh:139