diff options
| author | max42 <[email protected]> | 2023-06-30 03:37:03 +0300 |
|---|---|---|
| committer | max42 <[email protected]> | 2023-06-30 03:37:03 +0300 |
| commit | fac2bd72b4b31ec3238292caf8fb2a8aaa6d6c4a (patch) | |
| tree | b8cbc1deb00309c7f1a7ab6df520a76cf0b5c6d7 /yt/cpp/mapreduce/common/wait_proxy.cpp | |
| parent | 7bf166b1a7ed0af927f230022b245af618e998c1 (diff) | |
YT-19324: move YT provider to ydb/library/yql
This commit is formed by the following script: https://paste.yandex-team.ru/6f92e4b8-efc5-4d34-948b-15ee2accd7e7/text.
This commit has zero effect on all projects that depend on YQL.
The summary of changes:
- `yql/providers/yt -> ydb/library/yql/providers/yt `- the whole implementation of YT provider is moved into YDB code base for further export as a part of YT YQL plugin shared library;
- `yql/providers/stat/{expr_nodes,uploader} -> ydb/library/yql/providers/stat/{expr_nodes,uploader}` - a small interface without implementation and the description of stat expr nodes;
- `yql/core/extract_predicate/ut -> ydb/library/yql/core/extract_predicate/ut`;
- `yql/core/{ut,ut_common} -> ydb/library/yql/core/{ut,ut_common}`;
- `yql/core` is gone;
- `yql/library/url_preprocessing -> ydb/library/yql/core/url_preprocessing`.
**NB**: all new targets inside `ydb/` are under `IF (NOT CMAKE_EXPORT)` clause which disables them from open-source cmake generation and ya make build. They will be enabled in the subsequent commits.
Diffstat (limited to 'yt/cpp/mapreduce/common/wait_proxy.cpp')
| -rw-r--r-- | yt/cpp/mapreduce/common/wait_proxy.cpp | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/yt/cpp/mapreduce/common/wait_proxy.cpp b/yt/cpp/mapreduce/common/wait_proxy.cpp new file mode 100644 index 00000000000..3db034a0980 --- /dev/null +++ b/yt/cpp/mapreduce/common/wait_proxy.cpp @@ -0,0 +1,118 @@ +#include "wait_proxy.h" + + +#include <library/cpp/threading/future/future.h> + +#include <util/system/event.h> +#include <util/system/condvar.h> + +namespace NYT { +namespace NDetail { + +//////////////////////////////////////////////////////////////////////////////// + +bool TDefaultWaitProxy::WaitFuture(const NThreading::TFuture<void>& future, TDuration timeout) +{ + return future.Wait(timeout); +} + +bool TDefaultWaitProxy::WaitEvent(TSystemEvent& event, TDuration timeout) +{ + return event.WaitT(timeout); +} + +bool TDefaultWaitProxy::WaitCondVar(TCondVar &condVar, TMutex &mutex, TDuration timeout) +{ + return condVar.WaitT(mutex, timeout); +} + +void TDefaultWaitProxy::Sleep(TDuration timeout) +{ + ::Sleep(timeout); +} + +//////////////////////////////////////////////////////////////////////////////// + +TWaitProxy::TWaitProxy() + : Proxy_(::MakeIntrusive<TDefaultWaitProxy>()) +{ } + +TWaitProxy* TWaitProxy::Get() +{ + return Singleton<TWaitProxy>(); +} + +void TWaitProxy::SetProxy(::TIntrusivePtr<IWaitProxy> proxy) +{ + Proxy_ = std::move(proxy); +} + +bool TWaitProxy::WaitFuture(const NThreading::TFuture<void>& future) +{ + return Proxy_->WaitFuture(future, TDuration::Max()); +} + +bool TWaitProxy::WaitFuture(const NThreading::TFuture<void>& future, TInstant deadLine) +{ + return Proxy_->WaitFuture(future, deadLine - TInstant::Now()); +} + +bool TWaitProxy::WaitFuture(const NThreading::TFuture<void>& future, TDuration timeout) +{ + return Proxy_->WaitFuture(future, timeout); +} + +bool TWaitProxy::WaitEventD(TSystemEvent& event, TInstant deadLine) +{ + return Proxy_->WaitEvent(event, deadLine - TInstant::Now()); +} + +bool TWaitProxy::WaitEventT(TSystemEvent& event, TDuration timeout) +{ + return Proxy_->WaitEvent(event, timeout); +} + +void TWaitProxy::WaitEventI(TSystemEvent& event) +{ + Proxy_->WaitEvent(event, TDuration::Max()); +} + +bool TWaitProxy::WaitEvent(TSystemEvent& event) +{ + return Proxy_->WaitEvent(event, TDuration::Max()); +} + +bool TWaitProxy::WaitCondVarD(TCondVar& condVar, TMutex& m, TInstant deadLine) +{ + return Proxy_->WaitCondVar(condVar, m, deadLine - TInstant::Now()); +} + +bool TWaitProxy::WaitCondVarT(TCondVar& condVar, TMutex& m, TDuration timeOut) +{ + return Proxy_->WaitCondVar(condVar, m, timeOut); +} + +void TWaitProxy::WaitCondVarI(TCondVar& condVar, TMutex& m) +{ + Proxy_->WaitCondVar(condVar, m, TDuration::Max()); +} + +void TWaitProxy::WaitCondVar(TCondVar& condVar, TMutex& m) +{ + Proxy_->WaitCondVar(condVar, m, TDuration::Max()); +} + +void TWaitProxy::Sleep(TDuration timeout) +{ + Proxy_->Sleep(timeout); +} + +void TWaitProxy::SleepUntil(TInstant instant) +{ + Proxy_->Sleep(instant - TInstant::Now()); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NDetail +} // namespace NYT |
