mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 08:30:49 +00:00
37 lines
731 B
C++
37 lines
731 B
C++
#pragma once
|
|
|
|
// System independent critical sections without polluting the namespace with the operating system headers.
|
|
class FInternalCriticalSection;
|
|
FInternalCriticalSection *CreateCriticalSection();
|
|
void DeleteCriticalSection(FInternalCriticalSection *c);
|
|
void EnterCriticalSection(FInternalCriticalSection *c);
|
|
void LeaveCriticalSection(FInternalCriticalSection *c);
|
|
|
|
// This is just a convenience wrapper around the function interface.
|
|
class FCriticalSection
|
|
{
|
|
public:
|
|
FCriticalSection()
|
|
{
|
|
c = CreateCriticalSection();
|
|
}
|
|
|
|
~FCriticalSection()
|
|
{
|
|
DeleteCriticalSection(c);
|
|
}
|
|
|
|
void Enter()
|
|
{
|
|
EnterCriticalSection(c);
|
|
}
|
|
|
|
void Leave()
|
|
{
|
|
LeaveCriticalSection(c);
|
|
}
|
|
|
|
private:
|
|
FInternalCriticalSection *c;
|
|
|
|
};
|