aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/future/core
diff options
context:
space:
mode:
authorNikita Petrenko <npetrenko97@gmail.com>2022-02-10 16:50:57 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:57 +0300
commitfd3f62e99d2990dd93788742aaf6a9bd5cb4d5a3 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/threading/future/core
parentaa72317474c8df5627f69271ae16f4237e5d3612 (diff)
downloadydb-fd3f62e99d2990dd93788742aaf6a9bd5cb4d5a3.tar.gz
Restoring authorship annotation for Nikita Petrenko <npetrenko97@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/threading/future/core')
-rw-r--r--library/cpp/threading/future/core/future-inl.h134
-rw-r--r--library/cpp/threading/future/core/future.h28
-rw-r--r--library/cpp/threading/future/core/fwd.cpp2
-rw-r--r--library/cpp/threading/future/core/fwd.h22
4 files changed, 93 insertions, 93 deletions
diff --git a/library/cpp/threading/future/core/future-inl.h b/library/cpp/threading/future/core/future-inl.h
index a198a562e3..5fd4296a93 100644
--- a/library/cpp/threading/future/core/future-inl.h
+++ b/library/cpp/threading/future/core/future-inl.h
@@ -58,7 +58,7 @@ namespace NThreading {
state = AtomicGet(State);
}
- TryRethrowWithState(state);
+ TryRethrowWithState(state);
switch (AtomicGetAndCas(&State, acquireState, ValueSet)) {
case ValueSet:
@@ -106,11 +106,11 @@ namespace NThreading {
return AtomicGet(State) >= ValueMoved; // ValueMoved, ValueSet, ValueRead
}
- void TryRethrow() const {
- int state = AtomicGet(State);
- TryRethrowWithState(state);
- }
-
+ void TryRethrow() const {
+ int state = AtomicGet(State);
+ TryRethrowWithState(state);
+ }
+
bool HasException() const {
return AtomicGet(State) == ExceptionSet;
}
@@ -243,13 +243,13 @@ namespace NThreading {
Y_ASSERT(readyEvent);
return readyEvent->WaitD(deadline);
}
-
- void TryRethrowWithState(int state) const {
- if (Y_UNLIKELY(state == ExceptionSet)) {
- Y_ASSERT(Exception);
- std::rethrow_exception(Exception);
- }
- }
+
+ void TryRethrowWithState(int state) const {
+ if (Y_UNLIKELY(state == ExceptionSet)) {
+ Y_ASSERT(Exception);
+ std::rethrow_exception(Exception);
+ }
+ }
};
////////////////////////////////////////////////////////////////////////////////
@@ -287,11 +287,11 @@ namespace NThreading {
return AtomicGet(State) == ValueSet;
}
- void TryRethrow() const {
- int state = AtomicGet(State);
- TryRethrowWithState(state);
- }
-
+ void TryRethrow() const {
+ int state = AtomicGet(State);
+ TryRethrowWithState(state);
+ }
+
bool HasException() const {
return AtomicGet(State) == ExceptionSet;
}
@@ -310,7 +310,7 @@ namespace NThreading {
state = AtomicGet(State);
}
- TryRethrowWithState(state);
+ TryRethrowWithState(state);
Y_ASSERT(state == ValueSet);
}
@@ -429,13 +429,13 @@ namespace NThreading {
Y_ASSERT(readyEvent);
return readyEvent->WaitD(deadline);
}
-
- void TryRethrowWithState(int state) const {
- if (Y_UNLIKELY(state == ExceptionSet)) {
- Y_ASSERT(Exception);
- std::rethrow_exception(Exception);
- }
- }
+
+ void TryRethrowWithState(int state) const {
+ if (Y_UNLIKELY(state == ExceptionSet)) {
+ Y_ASSERT(Exception);
+ std::rethrow_exception(Exception);
+ }
+ }
};
////////////////////////////////////////////////////////////////////////////////
@@ -469,7 +469,7 @@ namespace NThreading {
inline void SetValueImpl(TPromise<void>& promise, const TFuture<T>& future) {
future.Subscribe([=](const TFuture<T>& f) mutable {
try {
- f.TryRethrow();
+ f.TryRethrow();
} catch (...) {
promise.SetException(std::current_exception());
return;
@@ -571,13 +571,13 @@ namespace NThreading {
}
template <typename T>
- inline void TFuture<T>::TryRethrow() const {
- if (State) {
- State->TryRethrow();
- }
- }
-
- template <typename T>
+ inline void TFuture<T>::TryRethrow() const {
+ if (State) {
+ State->TryRethrow();
+ }
+ }
+
+ template <typename T>
inline bool TFuture<T>::HasException() const {
return State && State->HasException();
}
@@ -612,13 +612,13 @@ namespace NThreading {
template <typename T>
template <typename F>
- inline const TFuture<T>& TFuture<T>::NoexceptSubscribe(F&& func) const noexcept {
- return Subscribe(std::forward<F>(func));
- }
-
-
- template <typename T>
- template <typename F>
+ inline const TFuture<T>& TFuture<T>::NoexceptSubscribe(F&& func) const noexcept {
+ return Subscribe(std::forward<F>(func));
+ }
+
+
+ template <typename T>
+ template <typename F>
inline TFuture<TFutureType<TFutureCallResult<F, T>>> TFuture<T>::Apply(F&& func) const {
auto promise = NewPromise<TFutureType<TFutureCallResult<F, T>>>();
Subscribe([promise, func = std::forward<F>(func)](const TFuture<T>& future) mutable {
@@ -677,12 +677,12 @@ namespace NThreading {
GetValue(TDuration::Max());
}
- inline void TFuture<void>::TryRethrow() const {
- if (State) {
- State->TryRethrow();
- }
- }
-
+ inline void TFuture<void>::TryRethrow() const {
+ if (State) {
+ State->TryRethrow();
+ }
+ }
+
inline bool TFuture<void>::HasException() const {
return State && State->HasException();
}
@@ -712,12 +712,12 @@ namespace NThreading {
}
template <typename F>
- inline const TFuture<void>& TFuture<void>::NoexceptSubscribe(F&& func) const noexcept {
- return Subscribe(std::forward<F>(func));
- }
-
-
- template <typename F>
+ inline const TFuture<void>& TFuture<void>::NoexceptSubscribe(F&& func) const noexcept {
+ return Subscribe(std::forward<F>(func));
+ }
+
+
+ template <typename F>
inline TFuture<TFutureType<TFutureCallResult<F, void>>> TFuture<void>::Apply(F&& func) const {
auto promise = NewPromise<TFutureType<TFutureCallResult<F, void>>>();
Subscribe([promise, func = std::forward<F>(func)](const TFuture<void>& future) mutable {
@@ -731,7 +731,7 @@ namespace NThreading {
auto promise = NewPromise<R>();
Subscribe([=](const TFuture<void>& future) mutable {
try {
- future.TryRethrow();
+ future.TryRethrow();
} catch (...) {
promise.SetException(std::current_exception());
return;
@@ -810,13 +810,13 @@ namespace NThreading {
}
template <typename T>
- inline void TPromise<T>::TryRethrow() const {
- if (State) {
- State->TryRethrow();
- }
- }
-
- template <typename T>
+ inline void TPromise<T>::TryRethrow() const {
+ if (State) {
+ State->TryRethrow();
+ }
+ }
+
+ template <typename T>
inline bool TPromise<T>::HasException() const {
return State && State->HasException();
}
@@ -892,12 +892,12 @@ namespace NThreading {
return State->TrySetValue();
}
- inline void TPromise<void>::TryRethrow() const {
- if(State) {
- State->TryRethrow();
- }
- }
-
+ inline void TPromise<void>::TryRethrow() const {
+ if(State) {
+ State->TryRethrow();
+ }
+ }
+
inline bool TPromise<void>::HasException() const {
return State && State->HasException();
}
diff --git a/library/cpp/threading/future/core/future.h b/library/cpp/threading/future/core/future.h
index 96889d2b80..2e82bb953e 100644
--- a/library/cpp/threading/future/core/future.h
+++ b/library/cpp/threading/future/core/future.h
@@ -93,7 +93,7 @@ namespace NThreading {
T ExtractValue(TDuration timeout = TDuration::Zero());
T ExtractValueSync();
- void TryRethrow() const;
+ void TryRethrow() const;
bool HasException() const;
void Wait() const;
@@ -103,12 +103,12 @@ namespace NThreading {
template <typename F>
const TFuture<T>& Subscribe(F&& callback) const;
- // precondition: EnsureInitialized() passes
- // postcondition: std::terminate is highly unlikely
+ // precondition: EnsureInitialized() passes
+ // postcondition: std::terminate is highly unlikely
+ template <typename F>
+ const TFuture<T>& NoexceptSubscribe(F&& callback) const noexcept;
+
template <typename F>
- const TFuture<T>& NoexceptSubscribe(F&& callback) const noexcept;
-
- template <typename F>
TFuture<TFutureType<TFutureCallResult<F, T>>> Apply(F&& func) const;
TFuture<void> IgnoreResult() const;
@@ -148,7 +148,7 @@ namespace NThreading {
void GetValue(TDuration timeout = TDuration::Zero()) const;
void GetValueSync() const;
- void TryRethrow() const;
+ void TryRethrow() const;
bool HasException() const;
void Wait() const;
@@ -158,12 +158,12 @@ namespace NThreading {
template <typename F>
const TFuture<void>& Subscribe(F&& callback) const;
- // precondition: EnsureInitialized() passes
- // postcondition: std::terminate is highly unlikely
+ // precondition: EnsureInitialized() passes
+ // postcondition: std::terminate is highly unlikely
+ template <typename F>
+ const TFuture<void>& NoexceptSubscribe(F&& callback) const noexcept;
+
template <typename F>
- const TFuture<void>& NoexceptSubscribe(F&& callback) const noexcept;
-
- template <typename F>
TFuture<TFutureType<TFutureCallResult<F, void>>> Apply(F&& func) const;
template <typename R>
@@ -212,7 +212,7 @@ namespace NThreading {
bool TrySetValue(const T& value);
bool TrySetValue(T&& value);
- void TryRethrow() const;
+ void TryRethrow() const;
bool HasException() const;
void SetException(const TString& e);
void SetException(std::exception_ptr e);
@@ -252,7 +252,7 @@ namespace NThreading {
void SetValue();
bool TrySetValue();
- void TryRethrow() const;
+ void TryRethrow() const;
bool HasException() const;
void SetException(const TString& e);
void SetException(std::exception_ptr e);
diff --git a/library/cpp/threading/future/core/fwd.cpp b/library/cpp/threading/future/core/fwd.cpp
index 2261ef316c..4214b6df83 100644
--- a/library/cpp/threading/future/core/fwd.cpp
+++ b/library/cpp/threading/future/core/fwd.cpp
@@ -1 +1 @@
-#include "fwd.h"
+#include "fwd.h"
diff --git a/library/cpp/threading/future/core/fwd.h b/library/cpp/threading/future/core/fwd.h
index c68e39f992..96eba9e6a3 100644
--- a/library/cpp/threading/future/core/fwd.h
+++ b/library/cpp/threading/future/core/fwd.h
@@ -1,11 +1,11 @@
-#pragma once
-
-namespace NThreading {
- struct TFutureException;
-
- template <typename T>
- class TFuture;
-
- template <typename T>
- class TPromise;
-}
+#pragma once
+
+namespace NThreading {
+ struct TFutureException;
+
+ template <typename T>
+ class TFuture;
+
+ template <typename T>
+ class TPromise;
+}