Code cleanup, move a lot of "Host" APIs to GpCommon

This commit is contained in:
elasota
2020-11-25 12:05:59 -05:00
parent 9d0f2c35b3
commit 5c640b72eb
102 changed files with 759 additions and 1072 deletions

View File

@@ -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;