From 82c065ae0c699be53988c61bc621b6738951f8c5 Mon Sep 17 00:00:00 2001 From: Reece Date: Mon, 8 Nov 2021 00:48:04 +0000 Subject: [PATCH] [*] Improve my nasty template enable when overloadable API by nudging an empty initializer list argument towards defining an empty FJob again [-] Remove old deprecated comment --- Include/Aurora/Async/IThreadPool.hpp | 3 +-- Include/Aurora/Async/WorkBasic.hpp | 10 +++++----- Source/Console/Commands/Commands.cpp | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Include/Aurora/Async/IThreadPool.hpp b/Include/Aurora/Async/IThreadPool.hpp index 0b160980..7bb06455 100644 --- a/Include/Aurora/Async/IThreadPool.hpp +++ b/Include/Aurora/Async/IThreadPool.hpp @@ -12,7 +12,6 @@ namespace Aurora::Async struct IThreadPool { // Spawning - /// @deprecated virtual bool Spawn(WorkerId_t workerId) = 0; // Event runner threads release the entire application upon encountering a zero work condition allowing for a clean exit of event driven apps without the headache of carefully chaining together exit callbacks @@ -20,7 +19,7 @@ namespace Aurora::Async // tl'dr: runner = true, async app; runner = false, thread pool virtual void SetRunningMode(bool eventRunning) = 0; - // Converts the current thread into an async thread with runner = false + // Converts the current thread into an async thread // Use with RunOnce, Poll virtual bool Create(WorkerId_t workerId) = 0; diff --git a/Include/Aurora/Async/WorkBasic.hpp b/Include/Aurora/Async/WorkBasic.hpp index d384295d..91b2d46d 100644 --- a/Include/Aurora/Async/WorkBasic.hpp +++ b/Include/Aurora/Async/WorkBasic.hpp @@ -24,13 +24,13 @@ namespace Aurora::Async return NewWork(worker, task, job, enableWait)->Dispatch(); } - template, typename Job_t = FJob, class a, class b, class c, class WorkerPId_tt = WorkerPId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v)> + template, typename Job_t = FJob, class a, class b = Job_t, class c, class WorkerPId_tt = WorkerPId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v)> static AuSPtr NewWork(const WorkerPId_tt &worker, a task, b job, c info, bool enableWait = false) { return worker.pool->NewWorkItem(worker, AuMakeShared>(task, job, info), enableWait); } - template, typename Job_t = FJob, class a, class b, class c, class WorkerPId_tt = WorkerPId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v)> + template, typename Job_t = FJob, class a, class b = Job_t, class c, class WorkerPId_tt = WorkerPId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v)> static AuSPtr DispatchWork(const WorkerPId_tt &worker, a task, b job, c info, bool enableWait = false) { return NewWork(worker, task, job, info, enableWait)->Dispatch(); @@ -69,13 +69,13 @@ namespace Aurora::Async return NewWork(worker, task, job, enableWait)->Dispatch(); } - template, typename Job_t = FJob, class a, class b, class c, class WorkerId_tt = WorkerId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v)> + template, typename Job_t = FJob, class a, class b = Job_t, class c, class WorkerId_tt = WorkerId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v)> static AuSPtr NewWork(const WorkerId_tt &worker, a task, b job, c info, bool enableWait = false) { return NewWorkItem(worker, AuMakeShared>(task, job, info), enableWait); } - template, typename Job_t = FJob, class a, class b, class c, class WorkerId_tt = WorkerId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v)> + template, typename Job_t = FJob, class a, class b = Job_t, class c, class WorkerId_tt = WorkerId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v)> static AuSPtr DispatchWork(const WorkerId_tt &worker, a task, b job, c info, bool enableWait = false) { return NewWork(worker, task, job, info, enableWait)->Dispatch(); @@ -94,7 +94,7 @@ namespace Aurora::Async } template, typename Job_t = FJob, typename ClazzImpl, class a = const Job_t &, class b = const Info_t &, class WorkerId_tt = WorkerId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v)> - AuSPtr DispatchVoid(const WorkerId_tt &worker, ClazzImpl task, a job, b inputParameters, bool enableWait = false) + AuSPtr DispatchVoid(const WorkerId_t &worker, ClazzImpl task, a job, b inputParameters, bool enableWait = false) { return NewWork(worker, TaskFromVoidVoid(task), job, inputParameters, enableWait); } diff --git a/Source/Console/Commands/Commands.cpp b/Source/Console/Commands/Commands.cpp index ed5fc364..92a90f9d 100644 --- a/Source/Console/Commands/Commands.cpp +++ b/Source/Console/Commands/Commands.cpp @@ -110,7 +110,7 @@ namespace Aurora::Console::Commands { dispatch.callback->OnCommand(dispatch.arguments); }), - AuAsync::FJob{}, + {}, CommandDispatch(res.result, callback), false );