CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CYBWin32Mutex.cpp
Go to the documentation of this file.
1 #include "CYB.hpp"
3 
5  Core().FModuleManager.Call<Modules::Kernel32::InitializeCriticalSection>(&FCriticalSection);
6 }
7 
9  Core().FModuleManager.Call<Modules::Kernel32::DeleteCriticalSection>(&FCriticalSection);
10 }
11 
13  Core().FModuleManager.Call<Modules::Kernel32::EnterCriticalSection>(&FCriticalSection);
14  std::atomic_thread_fence(std::memory_order_acquire);
15 }
16 
18  const auto Result(Core().FModuleManager.Call<Modules::Kernel32::TryEnterCriticalSection>(&FCriticalSection) == TRUE);
19  std::atomic_thread_fence(std::memory_order_acquire);
20  return Result;
21 }
22 
24  std::atomic_thread_fence(std::memory_order_release);
25  Core().FModuleManager.Call<Modules::Kernel32::LeaveCriticalSection>(&FCriticalSection);
26 }
Win32::CRITICAL_SECTION FCriticalSection
The CRITICAL_SECTION struct.
void Unlock(void) noexceptfinaloverride
Release a lock on a Mutex. Should only be called after a Lock or TryLock on the same Mutex was aquire...
void Lock(void) noexceptfinaloverride
Acquire a lock on a Mutex. This will block the current thread until the lock is aquired. The Mutex must not be owned by the current thread.
Platform::Modules::Manager FModuleManager
Loads and contains required modules.
Definition: CYBCore.hpp:20
Precompiled header for inter-engine operations.
bool TryLock(void) noexceptfinaloverride
Attempt to acquire a lock on a Mutex. This will not block the current thread. The Mutex must not be o...
Engine::Core & Core(void) noexcept
Retrieve the Core singleton.
Definition: CYBCore.cpp:69
auto Call(AArgs &&...AArguments)
Call a loaded function.
~Mutex() finaloverride
Destroy a Mutex. Mutex must be unlocked.
Mutex()
Constructs a Mutex.