2022-03-10 15:35:01 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: ThreadWorkerQueueShim.hpp
|
|
|
|
Date: 2022-3-9
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
2022-06-11 23:52:46 +00:00
|
|
|
#include <Source/IO/Loop/Loop.hpp>
|
|
|
|
#include <Source/IO/Loop/LoopQueue.hpp>
|
2022-03-10 15:35:01 +00:00
|
|
|
|
|
|
|
namespace Aurora::Async
|
|
|
|
{
|
2022-06-11 23:52:46 +00:00
|
|
|
struct AsyncLoop : AuLoop::LoopQueue
|
2022-03-10 15:35:01 +00:00
|
|
|
{
|
2023-11-11 10:11:09 +00:00
|
|
|
ThreadStateBase *pParent;
|
2022-03-10 15:35:01 +00:00
|
|
|
void OnFrame();
|
|
|
|
|
2022-06-11 23:52:46 +00:00
|
|
|
virtual bool AddCallback (const AuSPtr<AuLoop::ILoopSource> &source, const AuSPtr<AuLoop::ILoopSourceSubscriber> &subscriber) override;
|
|
|
|
virtual bool AddCallbackEx(const AuSPtr<AuLoop::ILoopSource> &source, const AuSPtr<AuLoop::ILoopSourceSubscriberEx> &subscriber) override;
|
|
|
|
virtual bool AddCallback (const AuSPtr<AuLoop::ILoopSourceSubscriber> &subscriber) override;
|
|
|
|
virtual bool Commit () override;
|
2022-03-10 15:35:01 +00:00
|
|
|
|
2022-11-17 20:56:41 +00:00
|
|
|
void Schedule();
|
|
|
|
bool CommitPending();
|
|
|
|
|
2022-03-10 15:35:01 +00:00
|
|
|
private:
|
2023-11-05 03:31:54 +00:00
|
|
|
AuUInt32 commitPending_ {};
|
2022-03-10 15:35:01 +00:00
|
|
|
};
|
|
|
|
}
|