forked from Public-Mirror/Textractor
bugfix concurrency
This commit is contained in:
parent
b8a76d79b7
commit
dd78e555f8
@ -24,7 +24,7 @@ ProcessEventCallback onAttach, onDetach;
|
||||
WORD nextThreadNumber;
|
||||
HWND dummyWindow;
|
||||
|
||||
#define HOST_LOCK CriticalSectionLocker hostLocker(hostCs) // Synchronized scope for accessing private data
|
||||
#define HOST_LOCK CriticalSectionLocker hostLocker(&hostCs) // Synchronized scope for accessing private data
|
||||
|
||||
void GetDebugPrivileges() // Artikash 5/19/2018: Is it just me or is this function 100% superfluous?
|
||||
{
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
extern HWND dummyWindow;
|
||||
|
||||
#define TT_LOCK CriticalSectionLocker ttLocker(ttCs) // Synchronized scope for accessing private data
|
||||
#define TT_LOCK CriticalSectionLocker ttLocker(&ttCs) // Synchronized scope for accessing private data
|
||||
|
||||
TextThread::TextThread(ThreadParameter tp, unsigned int threadNumber, DWORD status) :
|
||||
storage(),
|
||||
|
@ -12,24 +12,24 @@
|
||||
|
||||
class MutexLocker
|
||||
{
|
||||
HANDLE m;
|
||||
HANDLE mutex;
|
||||
public:
|
||||
explicit MutexLocker(HANDLE mutex) : m(mutex)
|
||||
explicit MutexLocker(HANDLE mutex) : mutex(mutex)
|
||||
{
|
||||
WaitForSingleObject(m, 0);
|
||||
WaitForSingleObject(mutex, 0);
|
||||
}
|
||||
~MutexLocker() { if (m != INVALID_HANDLE_VALUE && m != nullptr) ReleaseMutex(m); }
|
||||
~MutexLocker() { if (mutex != INVALID_HANDLE_VALUE && mutex != nullptr) ReleaseMutex(mutex); }
|
||||
};
|
||||
|
||||
class CriticalSectionLocker
|
||||
{
|
||||
CRITICAL_SECTION cs;
|
||||
CRITICAL_SECTION* cs;
|
||||
public:
|
||||
explicit CriticalSectionLocker(CRITICAL_SECTION cs) : cs(cs)
|
||||
explicit CriticalSectionLocker(CRITICAL_SECTION* cs) : cs(cs)
|
||||
{
|
||||
EnterCriticalSection(&cs);
|
||||
EnterCriticalSection(cs);
|
||||
}
|
||||
~CriticalSectionLocker() { LeaveCriticalSection(&cs); }
|
||||
~CriticalSectionLocker() { LeaveCriticalSection(cs); }
|
||||
};
|
||||
|
||||
// EOF
|
||||
|
Loading…
x
Reference in New Issue
Block a user