mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 12:09:36 +00:00
Code cleanup, move a lot of "Host" APIs to GpCommon
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "WorkerThread.h"
|
||||
#include "HostSystemServices.h"
|
||||
#include "HostThreadEvent.h"
|
||||
#include "IGpThreadEvent.h"
|
||||
#include "IGpSystemServices.h"
|
||||
|
||||
#include "PLDrivers.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
@@ -23,8 +25,8 @@ namespace PortabilityLayer
|
||||
static int StaticThreadFuncThunk(void *context);
|
||||
int ThreadFunc();
|
||||
|
||||
HostThreadEvent *m_wakeSignal;
|
||||
HostThreadEvent *m_wakeConsumedSignal;
|
||||
IGpThreadEvent *m_wakeSignal;
|
||||
IGpThreadEvent *m_wakeConsumedSignal;
|
||||
|
||||
Callback_t m_waitingCallback;
|
||||
void *m_waitingContext;
|
||||
@@ -55,9 +57,9 @@ PortabilityLayer::WorkerThreadImpl::WorkerThreadImpl()
|
||||
, m_waitingContext(nullptr)
|
||||
, m_terminated(false)
|
||||
, m_threadRunning(false)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PortabilityLayer::WorkerThreadImpl::~WorkerThreadImpl()
|
||||
{
|
||||
if (m_threadRunning)
|
||||
@@ -106,13 +108,13 @@ int PortabilityLayer::WorkerThreadImpl::ThreadFunc()
|
||||
|
||||
bool PortabilityLayer::WorkerThreadImpl::Init()
|
||||
{
|
||||
HostSystemServices *sysServices = HostSystemServices::GetInstance();
|
||||
IGpSystemServices *sysServices = PLDrivers::GetSystemServices();
|
||||
|
||||
m_wakeSignal = sysServices->CreateThreadEvent(true, false);
|
||||
if (!m_wakeSignal)
|
||||
return false;
|
||||
|
||||
m_wakeConsumedSignal = sysServices->CreateThreadEvent(true, false);
|
||||
m_wakeConsumedSignal = sysServices->CreateThreadEvent(true, false);
|
||||
if (!m_wakeConsumedSignal)
|
||||
return false;
|
||||
|
||||
@@ -123,20 +125,20 @@ bool PortabilityLayer::WorkerThreadImpl::Init()
|
||||
m_wakeSignal->Signal();
|
||||
m_wakeConsumedSignal->Wait();
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
PortabilityLayer::WorkerThread::WorkerThread()
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
PortabilityLayer::WorkerThread::~WorkerThread()
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
PortabilityLayer::WorkerThread *PortabilityLayer::WorkerThread::Create()
|
||||
{
|
||||
{
|
||||
void *storage = malloc(sizeof(PortabilityLayer::WorkerThreadImpl));
|
||||
if (!storage)
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user