diff --git a/Aurora.json b/Aurora.json index d80878a8..1c9093d0 100644 --- a/Aurora.json +++ b/Aurora.json @@ -14,7 +14,7 @@ { "if": "win32", "then": { - "links": "Bcrypt.lib" + "links": ["Bcrypt.lib", "UxTheme.lib"] } } ] diff --git a/Include/Aurora/Async/Async.hpp b/Include/Aurora/Async/Async.hpp index ba542153..a3573236 100644 --- a/Include/Aurora/Async/Async.hpp +++ b/Include/Aurora/Async/Async.hpp @@ -214,6 +214,41 @@ namespace Aurora::Async AUKN_SYM AuSPtr NewWorkItem(const WorkerId_t &worker, const AuSPtr &task, bool supportsBlocking = false); + class IAsyncApp + { + public: + // Main thread logic + virtual void Start() = 0; + virtual void Main() = 0; + virtual void Shutdown() = 0; + virtual bool Exiting() = 0; + virtual void SetConsoleCommandDispatcher(WorkerId_t id) = 0; + + // Spawning + virtual bool Spawn(WorkerId_t) = 0; + virtual Threading::Threads::ThreadShared_t ResolveHandle(WorkerId_t) = 0; + virtual AuBST> GetThreads() = 0; + virtual WorkerId_t GetCurrentThread() = 0; + + // Synchronization + // Note: syncing to yourself will nullify requireSignal to prevent deadlock + virtual bool Sync(WorkerId_t group, AuUInt32 timeoutMs = 0, bool requireSignal = false) = 0; + virtual void Signal(WorkerId_t group) = 0; + virtual void SyncAllSafe() = 0; + + // Features + virtual void AddFeature(WorkerId_t id, AuSPtr feature, bool async = false) = 0; + + // Debug + virtual void AssertInThreadGroup(ThreadGroup_t thread) = 0; + virtual void AssertWorker(WorkerId_t id) = 0; + + virtual bool Poll(bool block) = 0; + + virtual bool AddLoopSource(const AuSPtr &loopSource, WorkerId_t workerId, AuUInt32 timeout, const AuConsumer, bool> &callback) = 0; + }; + + #pragma region EASE_OF_READING struct BasicWorkStdFunc : IWorkItemHandler { @@ -339,7 +374,6 @@ namespace Aurora::Async private: - static constexpr bool IsCallbackPtr = std::is_pointer_v || AuIsBaseOfTemplate::value; static constexpr bool IsTaskPtr = std::is_pointer_v || AuIsBaseOfTemplate::value; @@ -534,14 +568,7 @@ namespace Aurora::Async { return TranslateAsyncReturnableFunctionToDispatcherWithThread(GetAsyncApp()->GetCurrentThread(), func); } - - #undef ASYNC_ERROR - #undef ASYNC_FINISH - -#endif - -#pragma endregion EASE_OF_READING - + template, typename Job_t = FJob> static AuSPtr DispatchBasicWorkCallback(const WorkerId_t &worker, const Task_t &task, const Job_t &job, bool enableWait = false) { @@ -554,38 +581,10 @@ namespace Aurora::Async return Async::NewWorkItem(worker, AuMakeShared>(task, job, inputParameters), enableWait)->Dispatch(); } + #undef ASYNC_ERROR + #undef ASYNC_FINISH - class IAsyncApp - { - public: - // Main thread logic - virtual void Start() = 0; - virtual void Main() = 0; - virtual void Shutdown() = 0; - virtual bool Exiting() = 0; - virtual void SetConsoleCommandDispatcher(WorkerId_t id) = 0; - - // Spawning - virtual bool Spawn(WorkerId_t) = 0; - virtual Threading::Threads::ThreadShared_t ResolveHandle(WorkerId_t) = 0; - virtual AuBST> GetThreads() = 0; - virtual WorkerId_t GetCurrentThread() = 0; - - // Synchronization - // Note: syncing to yourself will nullify requireSignal to prevent deadlock - virtual bool Sync(WorkerId_t group, AuUInt32 timeoutMs = 0, bool requireSignal = false) = 0; - virtual void Signal(WorkerId_t group) = 0; - virtual void SyncAllSafe() = 0; - - // Features - virtual void AddFeature(WorkerId_t id, AuSPtr feature, bool async = false) = 0; - - // Debug - virtual void AssertInThreadGroup(ThreadGroup_t thread) = 0; - virtual void AssertWorker(WorkerId_t id) = 0; - - virtual bool Poll(bool block) = 0; - - virtual bool AddLoopSource(const AuSPtr &loopSource, WorkerId_t workerId, AuUInt32 timeout, const AuConsumer, bool> &callback) = 0; - }; +#endif + +#pragma endregion EASE_OF_READING } \ No newline at end of file diff --git a/Include/Aurora/Runtime.hpp b/Include/Aurora/Runtime.hpp index 31032f38..1d07be9a 100644 --- a/Include/Aurora/Runtime.hpp +++ b/Include/Aurora/Runtime.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include "../AuroraTypedefs.hpp" #include "../AuroraUtils.hpp" diff --git a/Include/AuroraMacros.hpp b/Include/AuroraMacros.hpp index a7b96f24..5f1c0dca 100644 --- a/Include/AuroraMacros.hpp +++ b/Include/AuroraMacros.hpp @@ -82,7 +82,7 @@ name ## Shared_t name ## Shared(T... args) \ #if defined(AURORA_COMPILER_MSVC) #define AU_NORETURN __declspec(noreturn) #elif (defined(AURORA_COMPILER_CLANG) || defined(AURORA_COMPILER_GCC)) - #define AU_ALLOC __attribute__((noreturn)) + #define AU_NORETURN __attribute__((noreturn)) #elif defined(AU_LANG_CPP) #define AU_NORETURN [[noreturn]] #else