Reece
99c5e1fa65
[*] Split up Aurora Async [*] Split Async app into seperate ThreadPool concept [*] Fix various OSThread bugs and tls transfer issues [*] Set default affinity to 0xFFFFFFFF [*] Update Build script [+] Add AuTuplePopFront [+] New Network Interface (unimplemented) [*] Stub out the interfaces required for a better logger [*] Fix Win32 ShellExecute bug; windows 11 struggles without explicit com init per the docs - now deferring to thread pool [*] Update gitignore [*] Follow XDG home standard [*] Refactor some namespaces to use the shorthand aliases [*] Various stability fixes
52 lines
2.7 KiB
C++
52 lines
2.7 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AsyncApp.hpp
|
|
Date: 2021-6-26
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#include "ThreadPool.hpp"
|
|
|
|
namespace Aurora::Async
|
|
{
|
|
void InitApp();
|
|
void ReleaseApp();
|
|
|
|
struct AsyncApp : public IAsyncApp, ThreadPool
|
|
{
|
|
bool Spawn(WorkerId_t workerId) override;
|
|
void SetRunningMode(bool eventRunning) override;
|
|
bool Create(WorkerId_t workerId) override;
|
|
bool InRunnerMode() override;
|
|
bool Poll() override;
|
|
bool RunOnce() override;
|
|
bool Run() override;
|
|
void Shutdown() override;
|
|
bool Exiting() override;
|
|
AuSPtr<IWorkItem> NewWorkItem(const WorkerId_t &worker, const AuSPtr<IWorkItemHandler> &task, bool supportsBlocking) override;
|
|
AuSPtr<IWorkItem> NewFence() override;
|
|
Threading::Threads::ThreadShared_t ResolveHandle(WorkerId_t) override;
|
|
AuBST<ThreadGroup_t, AuList<ThreadId_t>> GetThreads() override;
|
|
WorkerId_t GetCurrentThread() override;
|
|
bool Sync(WorkerId_t workerId, AuUInt32 timeoutMs = 0, bool requireSignal = false) override;
|
|
void Signal(WorkerId_t workerId) override;
|
|
void SyncAllSafe() override;
|
|
void AddFeature(WorkerId_t id, AuSPtr<Threading::Threads::IThreadFeature> feature, bool async) override;
|
|
void AssertInThreadGroup(ThreadGroup_t group) override;
|
|
void AssertWorker(WorkerId_t id) override;
|
|
bool ScheduleLoopSource(const AuSPtr<Loop::ILoopSource> &loopSource, WorkerId_t workerId, AuUInt32 timeout, const AuConsumer<AuSPtr<Loop::ILoopSource>, bool> &callback) override;
|
|
|
|
|
|
// Main thread logic
|
|
void Start() override;
|
|
void Main() override;
|
|
void SetConsoleCommandDispatcher(WorkerId_t id) override;
|
|
|
|
void CleanUpWorker(WorkerId_t wid) override;
|
|
void CleanWorkerPoolReservedZeroFree() override;
|
|
|
|
AuOptional<WorkerId_t> commandDispatcher_;
|
|
};
|
|
} |