diff -r eb252f805431 -r 43a91b33f374 lemon/bits/windows.cc --- a/lemon/bits/windows.cc Fri Jan 20 19:08:00 2012 +0100 +++ b/lemon/bits/windows.cc Sun Jan 29 11:28:41 2012 +0100 @@ -130,5 +130,35 @@ return getpid() + tv.tv_sec + tv.tv_usec; #endif } + + WinLock::WinLock() { +#ifdef WIN32 + CRITICAL_SECTION *lock = new CRITICAL_SECTION; + InitializeCriticalSection(lock); + _repr = lock; +#endif + } + + WinLock::~WinLock() { +#ifdef WIN32 + CRITICAL_SECTION *lock = static_cast(_repr); + DeleteCriticalSection(lock); + delete lock; +#endif + } + + void WinLock::lock() { +#ifdef WIN32 + CRITICAL_SECTION *lock = static_cast(_repr); + EnterCriticalSection(lock); +#endif + } + + void WinLock::unlock() { +#ifdef WIN32 + CRITICAL_SECTION *lock = static_cast(_repr); + LeaveCriticalSection(lock); +#endif + } } }