diff options
author | Alexey Efimov <xeno@prnwatch.com> | 2022-02-10 16:49:41 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:41 +0300 |
commit | 26e0e4fb5e5cd6b4d7f4c21f9fcd7978891bf946 (patch) | |
tree | d34555f21d4d9f94f84d460e55b77d7eb41a953c /library/cpp/threading/future/core | |
parent | ca3252a147a429eac4ba8221857493c58dcd09b5 (diff) | |
download | ydb-26e0e4fb5e5cd6b4d7f4c21f9fcd7978891bf946.tar.gz |
Restoring authorship annotation for Alexey Efimov <xeno@prnwatch.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/threading/future/core')
-rw-r--r-- | library/cpp/threading/future/core/future-inl.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/library/cpp/threading/future/core/future-inl.h b/library/cpp/threading/future/core/future-inl.h index 5fd4296a93..b67d79e301 100644 --- a/library/cpp/threading/future/core/future-inl.h +++ b/library/cpp/threading/future/core/future-inl.h @@ -73,22 +73,22 @@ namespace NThreading { default: Y_ASSERT(state == ValueSet); } - } - + } + public: TFutureState() : State(NotReady) , NullValue(0) { - } - + } + template <typename TT> TFutureState(TT&& value) : State(ValueSet) , Value(std::forward<TT>(value)) { } - + TFutureState(std::exception_ptr exception, TError) : State(ExceptionSet) , Exception(std::move(exception)) @@ -101,11 +101,11 @@ namespace NThreading { Value.~T(); } } - + bool HasValue() const { return AtomicGet(State) >= ValueMoved; // ValueMoved, ValueSet, ValueRead - } - + } + void TryRethrow() const { int state = AtomicGet(State); TryRethrowWithState(state); @@ -148,7 +148,7 @@ namespace NThreading { readyEvent = ReadyEvent.Get(); callbacks = std::move(Callbacks); - + AtomicSet(State, ValueSet); } @@ -635,7 +635,7 @@ namespace NThreading { }); return promise; } - + template <typename T> inline bool TFuture<T>::Initialized() const { return bool(State); @@ -790,7 +790,7 @@ namespace NThreading { EnsureInitialized(); State->SetValue(value); } - + template <typename T> inline void TPromise<T>::SetValue(T&& value) { EnsureInitialized(); |