46 lines
908 B
C++
46 lines
908 B
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: LSMutex.NT.cpp
|
|
Date: 2021-10-1
|
|
Author: Reece
|
|
***/
|
|
#include <Source/RuntimeInternal.hpp>
|
|
#include "LSMutex.hpp"
|
|
|
|
namespace Aurora::Loop
|
|
{
|
|
bool Mutex::Unlock()
|
|
{
|
|
return ReleaseMutex(reinterpret_cast<HANDLE>(handle));
|
|
}
|
|
|
|
bool Mutex::IsSignaled()
|
|
{
|
|
return LSHandle::IsSignaled();
|
|
}
|
|
|
|
ELoopSource Mutex::GetType()
|
|
{
|
|
return ELoopSource::eSourceMutex;
|
|
}
|
|
|
|
AUKN_SYM AuSPtr<ILSMutex> NewLSMutex()
|
|
{
|
|
AuSPtr<ILSMutex> ret;
|
|
|
|
auto mutex = CreateMutex(NULL, false, NULL);
|
|
if (mutex == INVALID_HANDLE_VALUE)
|
|
{
|
|
SysPushErrorGen("Out of OS resources?");
|
|
return {};
|
|
}
|
|
|
|
if (!(ret = AuMakeShared<Mutex>(mutex)))
|
|
{
|
|
return {};
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
} |