AuroraRuntime/Source/Async/AuAsyncFuncRunnable.hpp

27 lines
761 B
C++
Raw Normal View History

/***
Copyright (C) 2021-2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuAsyncFuncRunnable.hpp
Date: 2023-12-06
Date: 2021-11-2
Author: Reece
***/
#pragma once
namespace Aurora::Async
{
struct AsyncFuncRunnable : IAsyncRunnable
{
AuFunction<void()> callback;
AuFunction<void()> fail;
AuCriticalSection lock;
AsyncFuncRunnable(AuFunction<void()> &&callback);
AsyncFuncRunnable(AuFunction<void()> &&callback, AuFunction<void()> &&fail);
AsyncFuncRunnable(const AuFunction<void()> &callback);
AsyncFuncRunnable(const AuFunction<void()> &callback, const AuFunction<void()> &fail);
void RunAsync() override;
void CancelAsync() override;
};
}