diff options
author | asorotsky <[email protected]> | 2022-02-10 16:47:33 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:33 +0300 |
commit | 80f0a6b4102e3b2c89f23935c7690409033ea24c (patch) | |
tree | d37ae19cf2360516f71e010c02f3fd8fc6b22999 /library/cpp/threading/future/core | |
parent | 9f1d4466bb653173233b0e47d2cbda7f46995f92 (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/threading/future/core')
-rw-r--r-- | library/cpp/threading/future/core/future-inl.h | 46 | ||||
-rw-r--r-- | library/cpp/threading/future/core/future.h | 4 |
2 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/threading/future/core/future-inl.h b/library/cpp/threading/future/core/future-inl.h index 5fd4296a93c..3973b9c1703 100644 --- a/library/cpp/threading/future/core/future-inl.h +++ b/library/cpp/threading/future/core/future-inl.h @@ -16,10 +16,10 @@ namespace NThreading { //////////////////////////////////////////////////////////////////////////////// - enum class TError { - Error - }; - + enum class TError { + Error + }; + template <typename T> class TFutureState: public TAtomicRefCount<TFutureState<T>> { enum { @@ -89,13 +89,13 @@ namespace NThreading { { } - TFutureState(std::exception_ptr exception, TError) - : State(ExceptionSet) - , Exception(std::move(exception)) - , NullValue(0) - { - } - + TFutureState(std::exception_ptr exception, TError) + : State(ExceptionSet) + , Exception(std::move(exception)) + , NullValue(0) + { + } + ~TFutureState() { if (State >= ValueMoved) { // ValueMoved, ValueSet, ValueRead Value.~T(); @@ -277,12 +277,12 @@ namespace NThreading { { } - TFutureState(std::exception_ptr exception, TError) - : State(ExceptionSet) - , Exception(std::move(exception)) - { - } - + TFutureState(std::exception_ptr exception, TError) + : State(ExceptionSet) + , Exception(std::move(exception)) + { + } + bool HasValue() const { return AtomicGet(State) == ValueSet; } @@ -971,12 +971,12 @@ namespace NThreading { return Singleton<TCache>()->Instance; } - template <typename T> - inline TFuture<T> MakeErrorFuture(std::exception_ptr exception) - { - return {new NImpl::TFutureState<T>(std::move(exception), NImpl::TError::Error)}; - } - + template <typename T> + inline TFuture<T> MakeErrorFuture(std::exception_ptr exception) + { + return {new NImpl::TFutureState<T>(std::move(exception), NImpl::TError::Error)}; + } + inline TFuture<void> MakeFuture() { struct TCache { TFuture<void> Instance{new NImpl::TFutureState<void>(true)}; diff --git a/library/cpp/threading/future/core/future.h b/library/cpp/threading/future/core/future.h index 2e82bb953eb..b8442f94c65 100644 --- a/library/cpp/threading/future/core/future.h +++ b/library/cpp/threading/future/core/future.h @@ -28,8 +28,8 @@ namespace NThreading { TFuture<std::remove_reference_t<T>> MakeFuture(T&& value); template <typename T> TFuture<T> MakeFuture(); - template <typename T> - TFuture<T> MakeErrorFuture(std::exception_ptr exception); + template <typename T> + TFuture<T> MakeErrorFuture(std::exception_ptr exception); TFuture<void> MakeFuture(); //////////////////////////////////////////////////////////////////////////////// |