60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: LSEvent.NT.cpp
|
|
Date: 2021-10-1
|
|
Author: Reece
|
|
***/
|
|
#include <Source/RuntimeInternal.hpp>
|
|
#include "LSEvent.hpp"
|
|
|
|
namespace Aurora::Loop
|
|
{
|
|
LSEvent::LSEvent(bool triggered, bool atomicRelease, bool permitMultipleTriggers) : LSHandle((AuUInt)::CreateEventW(NULL, !atomicRelease, triggered, NULL))
|
|
{
|
|
|
|
}
|
|
|
|
LSEvent::~LSEvent()
|
|
{
|
|
auto handle = reinterpret_cast<HANDLE>(this->handle);
|
|
AuWin32CloseHandle(handle);
|
|
}
|
|
|
|
bool LSEvent::Set()
|
|
{
|
|
return SetEvent(reinterpret_cast<HANDLE>(this->handle));
|
|
}
|
|
|
|
bool LSEvent::Reset()
|
|
{
|
|
return ResetEvent(reinterpret_cast<HANDLE>(this->handle));
|
|
}
|
|
|
|
bool LSEvent::IsSignaled()
|
|
{
|
|
return LSHandle::IsSignaled();
|
|
}
|
|
|
|
ELoopSource LSEvent::GetType()
|
|
{
|
|
return ELoopSource::eSourceEvent;
|
|
}
|
|
|
|
AUKN_SYM AuSPtr<ILSEvent> NewLSEvent(bool triggerd, bool atomicRelease, bool permitMultipleTriggers)
|
|
{
|
|
AuSPtr<LSEvent> ret;
|
|
|
|
if (!(ret = AuMakeShared<LSEvent>(triggerd, atomicRelease, permitMultipleTriggers)))
|
|
{
|
|
return {};
|
|
}
|
|
|
|
if (!ret->HasValidHandle())
|
|
{
|
|
return {};
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
} |