mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
33 lines
495 B
C++
33 lines
495 B
C++
#include "GpFiber_Win32.h"
|
|
#include <new>
|
|
|
|
GpFiber_Win32::GpFiber_Win32(LPVOID fiber)
|
|
: m_fiber(fiber)
|
|
{
|
|
}
|
|
|
|
void GpFiber_Win32::YieldTo()
|
|
{
|
|
SwitchToFiber(m_fiber);
|
|
}
|
|
|
|
void GpFiber_Win32::Destroy()
|
|
{
|
|
this->~GpFiber_Win32();
|
|
free(this);
|
|
}
|
|
|
|
GpFiber_Win32::~GpFiber_Win32()
|
|
{
|
|
DeleteFiber(m_fiber);
|
|
}
|
|
|
|
IGpFiber *GpFiber_Win32::Create(LPVOID fiber)
|
|
{
|
|
void *storage = malloc(sizeof(GpFiber_Win32));
|
|
if (!storage)
|
|
return nullptr;
|
|
|
|
return new (storage) GpFiber_Win32(fiber);
|
|
}
|