Loading src/sled/futures/future.h +6 −4 Original line number Diff line number Diff line Loading @@ -361,10 +361,11 @@ public: } template<typename Func, typename = EnableIfT<IsInvocable<Func>::value>> static Future<T, FailureT> Async(Func &&f) noexcept static Future<T, FailureT> Async(Func &&f, TaskQueueBase *scheduler = sled::GetDefaultScheduler()) noexcept { SLED_ASSERT(scheduler != nullptr, "TaskQueue is not valid"); Future<T, FailureT> result = Future<T, FailureT>::Create(); sled::GetDefaultScheduler()->PostTask([result, f]() mutable noexcept { scheduler->PostTask([result, f]() mutable noexcept { try { result.FillSuccess(f()); } catch (const std::exception &e) { Loading @@ -376,9 +377,10 @@ public: return result; } static Future<T, FailureT> AsyncValue(const T &value) noexcept static Future<T, FailureT> AsyncValue(const T &value, TaskQueueBase *scheduler = sled::GetDefaultScheduler()) noexcept { return Async([value]() { return value; }); return Async([value]() { return value; }, scheduler); } static Future<typename std::decay<T>::type, FailureT> Successful(T &&value) noexcept Loading Loading
src/sled/futures/future.h +6 −4 Original line number Diff line number Diff line Loading @@ -361,10 +361,11 @@ public: } template<typename Func, typename = EnableIfT<IsInvocable<Func>::value>> static Future<T, FailureT> Async(Func &&f) noexcept static Future<T, FailureT> Async(Func &&f, TaskQueueBase *scheduler = sled::GetDefaultScheduler()) noexcept { SLED_ASSERT(scheduler != nullptr, "TaskQueue is not valid"); Future<T, FailureT> result = Future<T, FailureT>::Create(); sled::GetDefaultScheduler()->PostTask([result, f]() mutable noexcept { scheduler->PostTask([result, f]() mutable noexcept { try { result.FillSuccess(f()); } catch (const std::exception &e) { Loading @@ -376,9 +377,10 @@ public: return result; } static Future<T, FailureT> AsyncValue(const T &value) noexcept static Future<T, FailureT> AsyncValue(const T &value, TaskQueueBase *scheduler = sled::GetDefaultScheduler()) noexcept { return Async([value]() { return value; }); return Async([value]() { return value; }, scheduler); } static Future<typename std::decay<T>::type, FailureT> Successful(T &&value) noexcept Loading