diff options
author | dronimal <dronimal@yandex-team.ru> | 2022-02-10 16:47:14 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:14 +0300 |
commit | f60febb7ea449535e7b073c386c7ff0539637fc0 (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/threading/future/core | |
parent | 2f2cfabf97857f24c4af02eed4ed9b5a14655bac (diff) | |
download | ydb-f60febb7ea449535e7b073c386c7ff0539637fc0.tar.gz |
Restoring authorship annotation for <dronimal@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/threading/future/core')
-rw-r--r-- | library/cpp/threading/future/core/future-inl.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/library/cpp/threading/future/core/future-inl.h b/library/cpp/threading/future/core/future-inl.h index c7b15fdb02..5fd4296a93 100644 --- a/library/cpp/threading/future/core/future-inl.h +++ b/library/cpp/threading/future/core/future-inl.h @@ -451,30 +451,30 @@ namespace NThreading { } template <typename T> - inline void SetValueImpl(TPromise<T>& promise, const TFuture<T>& future, - std::enable_if_t<!std::is_void<T>::value, bool> = false) { + inline void SetValueImpl(TPromise<T>& promise, const TFuture<T>& future, + std::enable_if_t<!std::is_void<T>::value, bool> = false) { future.Subscribe([=](const TFuture<T>& f) mutable { - T const* value; + T const* value; try { - value = &f.GetValue(); + value = &f.GetValue(); } catch (...) { promise.SetException(std::current_exception()); - return; + return; } - promise.SetValue(*value); + promise.SetValue(*value); }); } - template <typename T> - inline void SetValueImpl(TPromise<void>& promise, const TFuture<T>& future) { - future.Subscribe([=](const TFuture<T>& f) mutable { + template <typename T> + inline void SetValueImpl(TPromise<void>& promise, const TFuture<T>& future) { + future.Subscribe([=](const TFuture<T>& f) mutable { try { f.TryRethrow(); } catch (...) { promise.SetException(std::current_exception()); - return; + return; } - promise.SetValue(); + promise.SetValue(); }); } @@ -483,10 +483,10 @@ namespace NThreading { try { SetValueImpl(promise, func()); } catch (...) { - const bool success = promise.TrySetException(std::current_exception()); - if (Y_UNLIKELY(!success)) { - throw; - } + const bool success = promise.TrySetException(std::current_exception()); + if (Y_UNLIKELY(!success)) { + throw; + } } } @@ -497,9 +497,9 @@ namespace NThreading { func(); } catch (...) { promise.SetException(std::current_exception()); - return; + return; } - promise.SetValue(); + promise.SetValue(); } } @@ -631,7 +631,7 @@ namespace NThreading { inline TFuture<void> TFuture<T>::IgnoreResult() const { auto promise = NewPromise(); Subscribe([=](const TFuture<T>& future) mutable { - NImpl::SetValueImpl(promise, future); + NImpl::SetValueImpl(promise, future); }); return promise; } @@ -734,9 +734,9 @@ namespace NThreading { future.TryRethrow(); } catch (...) { promise.SetException(std::current_exception()); - return; + return; } - promise.SetValue(value); + promise.SetValue(value); }); return promise; } |