mirror of
https://github.com/GameHackingBook/GameHackingCode
synced 2026-06-08 11:08:54 +00:00
27 lines
299 B
C++
27 lines
299 B
C++
#pragma once
|
|
#include <Windows.h>
|
|
|
|
class ThreadLock
|
|
{
|
|
public:
|
|
ThreadLock()
|
|
{
|
|
InitializeCriticalSection(&cs);
|
|
}
|
|
|
|
~ThreadLock(){
|
|
DeleteCriticalSection(&cs);
|
|
}
|
|
|
|
void enter()
|
|
{
|
|
EnterCriticalSection(&cs);
|
|
}
|
|
|
|
void leave()
|
|
{
|
|
LeaveCriticalSection(&cs);
|
|
}
|
|
private:
|
|
CRITICAL_SECTION cs;
|
|
}; |