diff options
author | Alexey Efimov <xeno@prnwatch.com> | 2022-02-10 16:49:42 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:42 +0300 |
commit | 0fd1998e1b2369f50fb694556f817d3c7fef10c8 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/threading/future/core | |
parent | 26e0e4fb5e5cd6b4d7f4c21f9fcd7978891bf946 (diff) | |
download | ydb-0fd1998e1b2369f50fb694556f817d3c7fef10c8.tar.gz |
Restoring authorship annotation for Alexey Efimov <xeno@prnwatch.com>. Commit 2 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 b67d79e301..5fd4296a93 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(); |