From 95b181e618a0b85fa510160f6a22158d6a739ed1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 10 Mar 2017 22:19:36 +0100 Subject: [PATCH] -added missing file. --- src/critsec.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/critsec.h diff --git a/src/critsec.h b/src/critsec.h new file mode 100644 index 0000000000..ad510383b8 --- /dev/null +++ b/src/critsec.h @@ -0,0 +1,37 @@ +#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; + +};