AuroraRuntime/Source/Threading/Primitives/AuConditionMutex.NT.cpp

50 lines
1.0 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuConditionMutex.Win32.cpp
Date: 2021-6-12
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "AuConditionMutex.Generic.hpp"
#if !defined(_AURUNTIME_GENERICCM)
namespace Aurora::Threading::Primitives
{
Win32ConditionMutex::Win32ConditionMutex()
{
InitializeSRWLock(&this->lock_);
}
Win32ConditionMutex::~Win32ConditionMutex()
{
}
void Win32ConditionMutex::Lock()
{
AcquireSRWLockExclusive(&this->lock_);
}
void Win32ConditionMutex::Unlock()
{
ReleaseSRWLockExclusive(&this->lock_);
}
AuUInt Win32ConditionMutex::GetOSHandle()
{
return reinterpret_cast<AuUInt>(&this->lock_);
}
AUKN_SYM IConditionMutex *ConditionMutexNew()
{
return _new Win32ConditionMutex();
}
AUKN_SYM void ConditionMutexRelease(IConditionMutex *pMutex)
{
AuSafeDelete<Win32ConditionMutex *>(pMutex);
}
}
#endif