[*] BasicWorkStdFunc wrapper -> rename 'shutdown' property, made shutdown property optional

This commit is contained in:
Reece Wilson 2021-06-30 10:35:53 +01:00
parent 23ddb0f2f6
commit 6de84b474e

View File

@ -98,9 +98,9 @@ namespace Aurora::Async
struct BasicWorkStdFunc : IWorkItemHandler struct BasicWorkStdFunc : IWorkItemHandler
{ {
std::function<void()> callback; std::function<void()> callback;
std::function<void()> error; std::function<void()> shutdown;
BasicWorkStdFunc(std::function<void()> &&callback, std::function<void()> &&error) : callback(std::move(callback)), error(std::move(error)) BasicWorkStdFunc(std::function<void()> &&callback, std::function<void()> &&error) : callback(std::move(callback)), shutdown(std::move(shutdown))
{} {}
BasicWorkStdFunc(std::function<void()> &&callback) : callback(std::move(callback)) BasicWorkStdFunc(std::function<void()> &&callback) : callback(std::move(callback))
@ -109,7 +109,7 @@ namespace Aurora::Async
BasicWorkStdFunc(const std::function<void()> &callback) : callback(callback) BasicWorkStdFunc(const std::function<void()> &callback) : callback(callback)
{} {}
BasicWorkStdFunc(const std::function<void()> &callback, const std::function<void()> &error) : callback(callback), error(error) BasicWorkStdFunc(const std::function<void()> &callback, const std::function<void()> &shutdown) : callback(callback), shutdown(shutdown)
{} {}
private: private:
@ -130,7 +130,10 @@ namespace Aurora::Async
{ {
try try
{ {
error(); if (shutdown)
{
shutdown();
}
} }
catch (...) catch (...)
{ {