75 lines
1.6 KiB
C++
75 lines
1.6 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::IO::Loop
|
|
{
|
|
LSEvent::LSEvent(HANDLE h) : LSHandle(AuUInt(h))
|
|
{
|
|
|
|
}
|
|
|
|
LSEvent::LSEvent(bool triggered, bool atomicRelease, bool permitMultipleTriggers) //:
|
|
//LSHandle((AuUInt)::CreateEventW(NULL, !atomicRelease, triggered, NULL))
|
|
{
|
|
// WTF?
|
|
this->UpdateReadHandle((AuUInt)::CreateEventW(NULL, !atomicRelease, triggered, NULL));
|
|
}
|
|
|
|
LSEvent::~LSEvent()
|
|
{
|
|
auto handle = reinterpret_cast<HANDLE>(this->handle);
|
|
AuWin32CloseHandle(handle);
|
|
this->handle = kInvalidHandle;
|
|
}
|
|
|
|
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();
|
|
}
|
|
|
|
bool LSEvent::WaitOn(AuUInt32 timeout)
|
|
{
|
|
return LSHandle::WaitOn(timeout);
|
|
}
|
|
|
|
ELoopSource LSEvent::GetType()
|
|
{
|
|
return ELoopSource::eSourceEvent;
|
|
}
|
|
|
|
#if 0
|
|
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;
|
|
}
|
|
#endif
|
|
} |