10 #ifndef _LOG4SHIB_THREADING_MSTHREADS_HH 11 #define _LOG4SHIB_THREADING_MSTHREADS_HH 20 # define NOGDI // this will circumvent the ERROR #define in windows.h 21 # define LOG4SHIB_UNDEFINE_NOGDI 24 # ifndef WIN32_LEAN_AND_MEAN 25 # define WIN32_LEAN_AND_MEAN 26 # define LOG4SHIB_UNDEFINE_WIN32_LEAN_AND_MEAN 31 # ifdef LOG4SHIB_UNDEFINE_NOGDI 35 # ifdef LOG4SHIB_UNDEFINE_WIN32_LEAN_AND_MEAN 36 # undef WIN32_LEAN_AND_MEAN 39 #endif // done dealing with ERROR #define 55 MSMutex() { InitializeCriticalSection(&_criticalSection); }
56 ~MSMutex() { DeleteCriticalSection(&_criticalSection); }
58 return &_criticalSection;
63 CRITICAL_SECTION _criticalSection;
69 typedef MSMutex
Mutex;
79 EnterCriticalSection(_criticalSection);
86 LPCRITICAL_SECTION _criticalSection;
101 template<
typename T>
class ThreadLocalDataHolder {
113 inline T*
get()
const {
114 return (T*)TlsGetValue(_key);
139 T* result = (T*)TlsGetValue(_key);
140 TlsSetValue(_key, NULL);
151 T* thing = (T*)TlsGetValue(_key);
153 TlsSetValue(_key, p);
MSMutex()
Definition: MSThreads.hh:55
MSScopedLock(MSMutex &mutex)
Definition: MSThreads.hh:77
void reset(T *p=NULL)
Sets a new Object to be held for the current thread.
Definition: MSThreads.hh:150
T * operator->() const
Obtains the Object held for the current thread.
Definition: MSThreads.hh:123
boost::mutex Mutex
Dummy type 'int' for Mutex.
Definition: BoostThreads.hh:27
A simple object wrapper around WaitForSingleObject() and ReleaseMutex()
Definition: MSThreads.hh:75
ThreadLocalDataHolder()
Definition: MSThreads.hh:103
#define LOG4SHIB_EXPORT
Definition: Export.hh:11
boost::mutex::scoped_lock ScopedLock
Dummy type 'int' defintion of ScopedLock;.
Definition: BoostThreads.hh:30
LPCRITICAL_SECTION getCriticalSection()
Definition: MSThreads.hh:57
T * release()
Releases the Object held for the current thread.
Definition: MSThreads.hh:138
~MSScopedLock()
Definition: MSThreads.hh:82
static std::string getThreadId()
Return an identifier for the current thread.
Definition: BoostThreads.hh:22
T & operator*() const
Obtains the Object held for the current thread.
Definition: MSThreads.hh:130
The top level namespace for all 'Log for C++' types and classes.
Definition: AbortAppender.hh:16
~MSMutex()
Definition: MSThreads.hh:56
~ThreadLocalDataHolder()
Definition: MSThreads.hh:106
A simple object wrapper around CreateMutex() and DeleteMutex()
Definition: MSThreads.hh:53