Reece
7dca8ecd29
[*] Bug fix stupid mismatching variable usage with similar name in LoopQueue.NT.cpp
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
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
|
|
{
|
|
LSMutex::LSMutex(HANDLE handle) : LSHandle(AuReinterpretCast<AuUInt>(handle))
|
|
{}
|
|
|
|
LSMutex::~LSMutex()
|
|
{
|
|
auto handle = reinterpret_cast<HANDLE>(this->handle);
|
|
AuWin32CloseHandle(handle);
|
|
this->handle = kInvalidHandle;
|
|
}
|
|
|
|
bool LSMutex::Unlock()
|
|
{
|
|
return ReleaseMutex(reinterpret_cast<HANDLE>(handle));
|
|
}
|
|
|
|
bool LSMutex::IsSignaled()
|
|
{
|
|
return LSHandle::IsSignaled();
|
|
}
|
|
|
|
bool LSMutex::WaitOn(AuUInt32 timeout)
|
|
{
|
|
return LSHandle::WaitOn(timeout);
|
|
}
|
|
|
|
ELoopSource LSMutex::GetType()
|
|
{
|
|
return ELoopSource::eSourceMutex;
|
|
}
|
|
|
|
AUKN_SYM AuSPtr<ILSMutex> NewLSMutex()
|
|
{
|
|
AuSPtr<ILSMutex> ret;
|
|
|
|
auto mutex = ::CreateMutexW(NULL, false, NULL);
|
|
if (mutex == INVALID_HANDLE_VALUE)
|
|
{
|
|
SysPushErrorGen("Out of OS resources?");
|
|
return {};
|
|
}
|
|
|
|
return AuMakeShared<LSMutex>(mutex);
|
|
}
|
|
} |