[+] Stubbed out LSAsync
[*] Move classes to headers
This commit is contained in:
parent
ce47277488
commit
90e58db0e3
@ -1,7 +1,7 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: ILoopSourceEx.Generic.hpp
|
||||
File: ILoopSourceEx.hpp
|
||||
Date: 2021-10-3
|
||||
Author: Reece
|
||||
***/
|
||||
|
44
Source/Loop/LSAsync.cpp
Normal file
44
Source/Loop/LSAsync.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: LSAsync.cpp
|
||||
Date: 2021-10-3
|
||||
Author: Reece
|
||||
***/
|
||||
#include <Source/RuntimeInternal.hpp>
|
||||
#include "LSAsync.hpp"
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
class AsyncWaiter : public ILoopSource
|
||||
{
|
||||
public:
|
||||
AsyncWaiter()
|
||||
{}
|
||||
|
||||
bool IsSignaled() override;
|
||||
ELoopSource GetType() override;
|
||||
};
|
||||
|
||||
bool AsyncWaiter::IsSignaled()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
ELoopSource AsyncWaiter::GetType()
|
||||
{
|
||||
return ELoopSource::eSourceMutex;
|
||||
}
|
||||
|
||||
AUKN_SYM AuSPtr<ILoopSource> NewLSAsync()
|
||||
{
|
||||
AuSPtr<ILoopSource> ret;
|
||||
|
||||
if (!(ret = AuMakeShared<AsyncWaiter>()))
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
13
Source/Loop/LSAsync.hpp
Normal file
13
Source/Loop/LSAsync.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: LSAsync.hpp
|
||||
Date: 2021-10-3
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
|
||||
}
|
@ -7,23 +7,9 @@
|
||||
***/
|
||||
#include <Source/RuntimeInternal.hpp>
|
||||
#include "LSEvent.hpp"
|
||||
#include "LSHandle.hpp"
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
class Event : public ILSEvent, public LSHandle
|
||||
{
|
||||
public:
|
||||
Event(HANDLE handle) : LSHandle(reinterpret_cast<AuUInt>(handle))
|
||||
{}
|
||||
|
||||
bool Set() override;
|
||||
bool Reset() override;
|
||||
|
||||
bool ILSEvent::IsSignaled() override;
|
||||
ELoopSource ILSEvent::GetType() override;
|
||||
};
|
||||
|
||||
bool Event::Set()
|
||||
{
|
||||
return SetEvent(reinterpret_cast<HANDLE>(this->handle));
|
||||
|
@ -6,8 +6,20 @@
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
#include "LSHandle.hpp"
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
class Event : public ILSEvent, public LSHandle
|
||||
{
|
||||
public:
|
||||
Event(HANDLE handle) : LSHandle(reinterpret_cast<AuUInt>(handle))
|
||||
{}
|
||||
|
||||
bool Set() override;
|
||||
bool Reset() override;
|
||||
|
||||
bool ILSEvent::IsSignaled() override;
|
||||
ELoopSource ILSEvent::GetType() override;
|
||||
};
|
||||
}
|
@ -7,22 +7,9 @@
|
||||
***/
|
||||
#include <Source/RuntimeInternal.hpp>
|
||||
#include "LSMutex.hpp"
|
||||
#include "LSHandle.hpp"
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
class Mutex : public ILSMutex, public LSHandle
|
||||
{
|
||||
public:
|
||||
Mutex(HANDLE handle) : LSHandle(reinterpret_cast<AuUInt>(handle))
|
||||
{}
|
||||
|
||||
bool Unlock() override;
|
||||
|
||||
bool ILSMutex::IsSignaled() override;
|
||||
ELoopSource ILSMutex::GetType() override;
|
||||
};
|
||||
|
||||
bool Mutex::Unlock()
|
||||
{
|
||||
return ReleaseMutex(reinterpret_cast<HANDLE>(handle));
|
||||
|
@ -6,8 +6,19 @@
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
#include "LSHandle.hpp"
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
class Mutex : public ILSMutex, public LSHandle
|
||||
{
|
||||
public:
|
||||
Mutex(HANDLE handle) : LSHandle(reinterpret_cast<AuUInt>(handle))
|
||||
{}
|
||||
|
||||
bool Unlock() override;
|
||||
|
||||
bool ILSMutex::IsSignaled() override;
|
||||
ELoopSource ILSMutex::GetType() override;
|
||||
};
|
||||
}
|
@ -7,22 +7,9 @@
|
||||
***/
|
||||
#include <Source/RuntimeInternal.hpp>
|
||||
#include "LSSemaphore.hpp"
|
||||
#include "LSHandle.hpp"
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
class Semaphore : public ILSSemaphore, public LSHandle
|
||||
{
|
||||
public:
|
||||
Semaphore(HANDLE handle) : LSHandle(reinterpret_cast<AuUInt>(handle))
|
||||
{}
|
||||
|
||||
bool AddOne() override;
|
||||
|
||||
bool ILSSemaphore::IsSignaled() override;
|
||||
ELoopSource ILSSemaphore::GetType() override;
|
||||
};
|
||||
|
||||
bool Semaphore::AddOne()
|
||||
{
|
||||
LONG atomicOld;
|
||||
|
@ -6,8 +6,19 @@
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
#include "LSHandle.hpp"
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
class Semaphore : public ILSSemaphore, public LSHandle
|
||||
{
|
||||
public:
|
||||
Semaphore(HANDLE handle) : LSHandle(reinterpret_cast<AuUInt>(handle))
|
||||
{}
|
||||
|
||||
bool AddOne() override;
|
||||
|
||||
bool ILSSemaphore::IsSignaled() override;
|
||||
ELoopSource ILSSemaphore::GetType() override;
|
||||
};
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
#include "LSHandle.hpp"
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
|
14
Source/Loop/Loop.BSD.cpp
Normal file
14
Source/Loop/Loop.BSD.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: Loop.BSD.cpp
|
||||
Date: 2021-10-1
|
||||
Author: Reece
|
||||
***/
|
||||
#include <Source/RuntimeInternal.hpp>
|
||||
#include "Loop.BSD.hpp"
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
// TODO: kevent + pipe abuse
|
||||
}
|
13
Source/Loop/Loop.BSD.hpp
Normal file
13
Source/Loop/Loop.BSD.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: Loop.BSD.hpp
|
||||
Date: 2021-10-1
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
namespace Aurora::Loop
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user