Lots of stuff

This commit is contained in:
elasota
2019-11-11 00:11:59 -05:00
parent 49a35bb15b
commit c8472f7295
406 changed files with 58313 additions and 88 deletions

49
GpD3D/GpEvent_Win32.cpp Normal file
View File

@@ -0,0 +1,49 @@
#include "GpEvent.h"
#include "GpWindows.h"
#include <assert.h>
GpEvent::~GpEvent()
{
CloseHandle(static_cast<HANDLE>(m_PrivateData));
}
void GpEvent::Wait()
{
WaitForSingleObject(static_cast<HANDLE>(m_PrivateData), INFINITE);
}
void GpEvent::WaitMSec(unsigned int msec)
{
assert(msec < MAXDWORD);
WaitForSingleObject(static_cast<HANDLE>(m_PrivateData), static_cast<DWORD>(msec));
}
void GpEvent::Signal()
{
SetEvent(static_cast<HANDLE>(m_PrivateData));
}
void GpEvent::Reset()
{
ResetEvent(static_cast<HANDLE>(m_PrivateData));
}
void GpEvent::Destroy()
{
delete this;
}
GpEvent *GpEvent::Create(bool autoReset, bool startSignalled)
{
HANDLE handle = CreateEventA(nullptr, autoReset ? FALSE : TRUE, startSignalled ? TRUE : FALSE, nullptr);
if (!handle)
return nullptr;
return new GpEvent(handle);
}
GpEvent::GpEvent(void *privateData)
: m_PrivateData(privateData)
{
}