|
@@ -116,6 +116,9 @@ namespace NThreading {
|
|
|
bool HasException() const {
|
|
|
return AtomicGet(State) == ExceptionSet;
|
|
|
}
|
|
|
+ bool IsReady() const {
|
|
|
+ return AtomicGet(State) != NotReady;
|
|
|
+ }
|
|
|
|
|
|
const T& GetValue(TDuration timeout = TDuration::Zero()) const {
|
|
|
AccessValue(timeout, ValueRead);
|
|
@@ -297,6 +300,9 @@ namespace NThreading {
|
|
|
bool HasException() const {
|
|
|
return AtomicGet(State) == ExceptionSet;
|
|
|
}
|
|
|
+ bool IsReady() const {
|
|
|
+ return AtomicGet(State) != NotReady;
|
|
|
+ }
|
|
|
|
|
|
void GetValue(TDuration timeout = TDuration::Zero()) const {
|
|
|
TAtomicBase state = AtomicGet(State);
|
|
@@ -583,6 +589,10 @@ namespace NThreading {
|
|
|
inline bool TFuture<T>::HasException() const {
|
|
|
return State && State->HasException();
|
|
|
}
|
|
|
+ template <typename T>
|
|
|
+ inline bool TFuture<T>::IsReady() const {
|
|
|
+ return State && State->IsReady();
|
|
|
+ }
|
|
|
|
|
|
template <typename T>
|
|
|
inline void TFuture<T>::Wait() const {
|
|
@@ -688,6 +698,9 @@ namespace NThreading {
|
|
|
inline bool TFuture<void>::HasException() const {
|
|
|
return State && State->HasException();
|
|
|
}
|
|
|
+ inline bool TFuture<void>::IsReady() const {
|
|
|
+ return State && State->IsReady();
|
|
|
+ }
|
|
|
|
|
|
inline void TFuture<void>::Wait() const {
|
|
|
EnsureInitialized();
|
|
@@ -823,6 +836,11 @@ namespace NThreading {
|
|
|
return State && State->HasException();
|
|
|
}
|
|
|
|
|
|
+ template <typename T>
|
|
|
+ inline bool TPromise<T>::IsReady() const {
|
|
|
+ return State && State->IsReady();
|
|
|
+ }
|
|
|
+
|
|
|
template <typename T>
|
|
|
inline void TPromise<T>::SetException(const TString& e) {
|
|
|
EnsureInitialized();
|
|
@@ -904,6 +922,10 @@ namespace NThreading {
|
|
|
return State && State->HasException();
|
|
|
}
|
|
|
|
|
|
+ inline bool TPromise<void>::IsReady() const {
|
|
|
+ return State && State->IsReady();
|
|
|
+ }
|
|
|
+
|
|
|
inline void TPromise<void>::SetException(const TString& e) {
|
|
|
EnsureInitialized();
|
|
|
State->SetException(std::make_exception_ptr(yexception() << e));
|