summaryrefslogtreecommitdiffstats
path: root/other-licenses/7zstub/src/Windows/Synchronization.h
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-04-05 20:01:10 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-04-05 20:01:10 +0200
commitc3b63b831cd2c64700e875b28540212c7c881ac6 (patch)
treeedd98fcbd2004d3b562904f822bf6c3322fc7f52 /other-licenses/7zstub/src/Windows/Synchronization.h
parentd432e068a21c815d5d5e7bcbc1cc8c6e77a7d1e0 (diff)
parentcc07da9cb4d6e7a53f8d953427ffc2bca2e0c2df (diff)
downloadUXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar
UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.gz
UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.lz
UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.xz
UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.zip
Merge branch 'master' into 816
Diffstat (limited to 'other-licenses/7zstub/src/Windows/Synchronization.h')
-rw-r--r--other-licenses/7zstub/src/Windows/Synchronization.h114
1 files changed, 0 insertions, 114 deletions
diff --git a/other-licenses/7zstub/src/Windows/Synchronization.h b/other-licenses/7zstub/src/Windows/Synchronization.h
deleted file mode 100644
index aff3356be..000000000
--- a/other-licenses/7zstub/src/Windows/Synchronization.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Windows/Synchronization.h
-
-#ifndef __WINDOWS_SYNCHRONIZATION_H
-#define __WINDOWS_SYNCHRONIZATION_H
-
-#include "Defs.h"
-#include "Handle.h"
-
-namespace NWindows {
-namespace NSynchronization {
-
-class CObject: public CHandle
-{
-public:
- bool Lock(DWORD timeoutInterval = INFINITE)
- { return (::WaitForSingleObject(_handle, timeoutInterval) == WAIT_OBJECT_0); }
-};
-
-class CBaseEvent: public CObject
-{
-public:
- bool Create(bool manualReset, bool initiallyOwn, LPCTSTR name = NULL,
- LPSECURITY_ATTRIBUTES securityAttributes = NULL)
- {
- _handle = ::CreateEvent(securityAttributes, BoolToBOOL(manualReset),
- BoolToBOOL(initiallyOwn), name);
- return (_handle != 0);
- }
-
- bool Open(DWORD desiredAccess, bool inheritHandle, LPCTSTR name)
- {
- _handle = ::OpenEvent(desiredAccess, BoolToBOOL(inheritHandle), name);
- return (_handle != 0);
- }
-
- bool Set() { return BOOLToBool(::SetEvent(_handle)); }
- bool Pulse() { return BOOLToBool(::PulseEvent(_handle)); }
- bool Reset() { return BOOLToBool(::ResetEvent(_handle)); }
-};
-
-class CEvent: public CBaseEvent
-{
-public:
- CEvent() {};
- CEvent(bool manualReset, bool initiallyOwn,
- LPCTSTR name = NULL, LPSECURITY_ATTRIBUTES securityAttributes = NULL);
-};
-
-class CManualResetEvent: public CEvent
-{
-public:
- CManualResetEvent(bool initiallyOwn = false, LPCTSTR name = NULL,
- LPSECURITY_ATTRIBUTES securityAttributes = NULL):
- CEvent(true, initiallyOwn, name, securityAttributes) {};
-};
-
-class CAutoResetEvent: public CEvent
-{
-public:
- CAutoResetEvent(bool initiallyOwn = false, LPCTSTR name = NULL,
- LPSECURITY_ATTRIBUTES securityAttributes = NULL):
- CEvent(false, initiallyOwn, name, securityAttributes) {};
-};
-
-class CMutex: public CObject
-{
-public:
- bool Create(bool initiallyOwn, LPCTSTR name = NULL,
- LPSECURITY_ATTRIBUTES securityAttributes = NULL)
- {
- _handle = ::CreateMutex(securityAttributes, BoolToBOOL(initiallyOwn), name);
- return (_handle != 0);
- }
- bool Open(DWORD desiredAccess, bool inheritHandle, LPCTSTR name)
- {
- _handle = ::OpenMutex(desiredAccess, BoolToBOOL(inheritHandle), name);
- return (_handle != 0);
- }
- bool Release() { return BOOLToBool(::ReleaseMutex(_handle)); }
-};
-
-class CMutexLock
-{
- CMutex &_object;
-public:
- CMutexLock(CMutex &object): _object(object) { _object.Lock(); }
- ~CMutexLock() { _object.Release(); }
-};
-
-class CCriticalSection
-{
- CRITICAL_SECTION _object;
- // void Initialize() { ::InitializeCriticalSection(&_object); }
- // void Delete() { ::DeleteCriticalSection(&_object); }
-public:
- CCriticalSection() { ::InitializeCriticalSection(&_object); }
- ~CCriticalSection() { ::DeleteCriticalSection(&_object); }
- void Enter() { ::EnterCriticalSection(&_object); }
- void Leave() { ::LeaveCriticalSection(&_object); }
-};
-
-class CCriticalSectionLock
-{
- CCriticalSection &_object;
- void Unlock() { _object.Leave(); }
-public:
- CCriticalSectionLock(CCriticalSection &object): _object(object)
- {_object.Enter(); }
- ~CCriticalSectionLock() { Unlock(); }
-};
-
-}}
-
-#endif