diff options
Diffstat (limited to 'yt/cpp/mapreduce/client/client.cpp')
| -rw-r--r-- | yt/cpp/mapreduce/client/client.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/yt/cpp/mapreduce/client/client.cpp b/yt/cpp/mapreduce/client/client.cpp index c4bb54d1a7d..48ad4a352ea 100644 --- a/yt/cpp/mapreduce/client/client.cpp +++ b/yt/cpp/mapreduce/client/client.cpp @@ -1516,10 +1516,14 @@ TYtPoller& TClient::GetYtPoller() void TClient::Shutdown() { - auto g = Guard(Lock_); - - if (!Shutdown_.exchange(true) && YtPoller_) { - YtPoller_->Stop(); + std::unique_ptr<TYtPoller> poller; + with_lock(Lock_) { + if (!Shutdown_.exchange(true) && YtPoller_) { + poller = std::move(YtPoller_); + } + } + if (poller) { + poller->Stop(); } } |
