18template<
typename ResultType>
class TFuture;
20template<
typename ResultType>
class TPromise;
27 template <
typename Type>
143template<
typename ResultType>
222template <
typename ResultType>
242 return this->
GetState()->GetResult();
247 return this->
GetState()->GetResult();
258 return State.IsValid() ? State->IsComplete() :
false;
269 return State.IsValid();
297 return State.IsValid() ? State->WaitFor(
Duration) :
false;
341 check(State.IsValid());
353 template<
typename Func>
363 template<
typename Func>
375 this->State->SetContinuation(
nullptr);
390template<
typename ResultType>
425 requires (!std::is_object_v<ResultType>)
427 return (MutableResultType)this->
Get();
432 return (MutableResultType)this->
Get();
444 return (RvalueResultType)
Local.Get();
487template<
typename ResultType>
520 ConstResultType
Get()
const
539template<
typename ResultType>
545 using SetType = std::conditional_t<std::is_void_v<ResultType>, int, ResultType>;
578 check(State->IsComplete());
589 check(!bFutureRetrieved);
590 bFutureRetrieved =
true;
604 requires(!std::is_void_v<ResultType>)
609 requires(!std::is_void_v<ResultType> && !std::is_lvalue_reference_v<ResultType>)
614 requires(std::is_void_v<ResultType>)
643 check(State.IsValid());
653 bool bFutureRetrieved =
false;
664 template<
typename Func,
typename ParamType,
typename ResultType>
669 template<
typename Func,
typename ParamType>
678template<
typename ResultType>
679template<
typename Func>
699template<
typename ResultType>
700template<
typename Func>
705 if constexpr (std::is_void_v<ResultType>)
710 UE_STATIC_DEPRECATE(5.6,
true,
"Passing continuations to TFuture<void>::Next which take int parameters has been deprecated - please remove the parameter.");
726template<
typename ResultType,
typename...
ArgTypes>
734#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_7
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define check(expr)
Definition AssertionMacros.h:314
return Self
Definition CocoaThread.cpp:337
#define UE_STATIC_DEPRECATE(Version, bExpression, Message)
Definition CoreMiscDefines.h:420
TSharedRef< InObjectType, InMode > MakeShared(InArgTypes &&... Args)
Definition SharedPointer.h:2009
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
TPromise< ResultType > MakeFulfilledPromise(ArgTypes &&... Args)
Definition Future.h:727
float Val(const FString &Value)
Definition UnrealMath.cpp:3163
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
FRWLock Lock
Definition UnversionedPropertySerialization.cpp:921
virtual bool Wait(uint32 WaitTime, const bool bIgnoreThreadIdleStats=false)=0
FFutureState(TUniqueFunction< void()> &&InCompletionCallback)
Definition Future.h:49
void SetContinuation(TUniqueFunction< void()> &&Continuation)
Definition Future.h:88
void MarkComplete()
Definition Future.h:109
bool IsComplete() const
Definition Future.h:62
bool WaitFor(const FTimespan &Duration) const
Definition Future.h:74
Definition ScopeLock.h:141
bool WaitFor(const FTimespan &Duration) const
Definition Future.h:295
typename StateType::MutableResultType MutableResultType
Definition Future.h:229
ConstResultType Get() const UE_LIFETIMEBOUND
Definition Future.h:244
bool IsValid() const
Definition Future.h:267
TFutureBase(TSharedPtr< StateType > &&InState)
Definition Future.h:322
typename StateType::RvalueResultType RvalueResultType
Definition Future.h:231
bool WaitUntil(const FDateTime &Time) const
Definition Future.h:307
typename StateType::ConstResultType ConstResultType
Definition Future.h:230
const TSharedPtr< StateType > & GetState() const
Definition Future.h:336
bool IsReady() const
Definition Future.h:256
ConstResultType Get() const
Definition Future.h:239
auto Then(Func Continuation)
Definition Future.h:680
auto Next(Func Continuation)
Definition Future.h:701
void Wait() const
Definition Future.h:280
void Reset()
Definition Future.h:371
TFutureBase(const TSharedPtr< StateType > &InState)
Definition Future.h:326
~TFutureState()
Definition Future.h:157
typename TTypeCompatibleBytes< ResultType >::ConstGetType ConstResultType
Definition Future.h:149
TFutureState(TUniqueFunction< void()> &&CompletionCallback)
Definition Future.h:170
typename TTypeCompatibleBytes< ResultType >::MutableGetType MutableResultType
Definition Future.h:148
TFutureState()
Definition Future.h:153
typename TTypeCompatibleBytes< ResultType >::RvalueGetType RvalueResultType
Definition Future.h:150
MutableResultType GetResult()
Definition Future.h:182
ConstResultType GetResult() const
Definition Future.h:191
void EmplaceResult(ArgTypes &&... Args)
Definition Future.h:203
TFuture(const TFuture &)=delete
TSharedFuture< ResultType > Share()
Definition Future.h:452
TFuture & operator=(TFuture &&)=default
TFuture(TFuture &&)=default
MutableResultType GetMutable()
Definition Future.h:424
TFuture & operator=(const TFuture &)=delete
MutableResultType GetMutable() UE_LIFETIMEBOUND
Definition Future.h:429
ResultType Consume()
Definition Future.h:441
TPromise()
Definition Future.h:550
const TSharedPtr< StateType > & GetState()
Definition Future.h:639
void SetValue()
Definition Future.h:613
TFuture< ResultType > GetFuture()
Definition Future.h:587
~TPromise()
Definition Future.h:572
TPromise(TPromise &&Other)=default
void SetValue(const SetType &Result)
Definition Future.h:603
TPromise(TUniqueFunction< void()> &&CompletionCallback)
Definition Future.h:560
TPromise & operator=(const TPromise &Other)=delete
void EmplaceValue(ArgTypes &&... Args)
Definition Future.h:628
void SetValue(SetType &&Result)
Definition Future.h:608
TPromise(const TPromise &Other)=delete
TPromise & operator=(TPromise &&Other)=default
ConstResultType Get() const
Definition Future.h:520
TSharedFuture(TFuture< ResultType > &&Future)
Definition Future.h:510
Definition SharedPointer.h:692
Definition FunctionFwd.h:19
implementation
Definition PlayInEditorLoadingScope.h:8
static CORE_API FDateTime UtcNow()
Definition DateTime.cpp:980
Definition PooledSyncEvent.h:9
static FTimespan MaxValue()
Definition Timespan.h:686
Definition TypeCompatibleBytes.h:24
ElementType & GetUnchecked() &
Definition TypeCompatibleBytes.h:52
ElementType & MutableGetType
Definition TypeCompatibleBytes.h:47
const ElementType & ConstGetType
Definition TypeCompatibleBytes.h:48
void DestroyUnchecked()
Definition TypeCompatibleBytes.h:75
ElementType && RvalueGetType
Definition TypeCompatibleBytes.h:49
void EmplaceUnchecked(ArgTypes &&... Args)
Definition TypeCompatibleBytes.h:68
auto Requires(Type &Callable, int32 Val) -> decltype(Callable(Val))