mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
bugfix concurrency
This commit is contained in:
parent
b8a76d79b7
commit
dd78e555f8
@ -24,7 +24,7 @@ ProcessEventCallback onAttach, onDetach;
|
|||||||
WORD nextThreadNumber;
|
WORD nextThreadNumber;
|
||||||
HWND dummyWindow;
|
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?
|
void GetDebugPrivileges() // Artikash 5/19/2018: Is it just me or is this function 100% superfluous?
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
extern HWND dummyWindow;
|
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) :
|
TextThread::TextThread(ThreadParameter tp, unsigned int threadNumber, DWORD status) :
|
||||||
storage(),
|
storage(),
|
||||||
|
@ -12,24 +12,24 @@
|
|||||||
|
|
||||||
class MutexLocker
|
class MutexLocker
|
||||||
{
|
{
|
||||||
HANDLE m;
|
HANDLE mutex;
|
||||||
public:
|
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
|
class CriticalSectionLocker
|
||||||
{
|
{
|
||||||
CRITICAL_SECTION cs;
|
CRITICAL_SECTION* cs;
|
||||||
public:
|
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
|
// EOF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user