diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/messagebus/oldmodule/startsession.cpp | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/oldmodule/startsession.cpp')
-rw-r--r-- | library/cpp/messagebus/oldmodule/startsession.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/library/cpp/messagebus/oldmodule/startsession.cpp b/library/cpp/messagebus/oldmodule/startsession.cpp index 76171ba1d5..7c38801d62 100644 --- a/library/cpp/messagebus/oldmodule/startsession.cpp +++ b/library/cpp/messagebus/oldmodule/startsession.cpp @@ -1,14 +1,14 @@ /////////////////////////////////////////////////////////// -/// \file +/// \file /// \brief Starter session implementation - + /// Starter session will generate emtpy message to insert /// into local session that are registered under same protocol - + /// Starter (will one day) automatically adjust number /// of message inflight to make sure that at least one of source /// sessions within message queue is at the limit (bottle neck) - + /// Maximum number of messages that starter will instert into /// the pipeline is configured by NBus::TBusSessionConfig::MaxInFlight @@ -19,46 +19,46 @@ #include <library/cpp/messagebus/ybus.h> namespace NBus { - void* TBusStarter::_starter(void* data) { - TBusStarter* pThis = static_cast<TBusStarter*>(data); - pThis->Starter(); - return nullptr; - } + void* TBusStarter::_starter(void* data) { + TBusStarter* pThis = static_cast<TBusStarter*>(data); + pThis->Starter(); + return nullptr; + } - TBusStarter::TBusStarter(TBusModule* module, const TBusSessionConfig& config) - : Module(module) - , Config(config) - , StartThread(_starter, this) - , Exiting(false) - { - StartThread.Start(); - } + TBusStarter::TBusStarter(TBusModule* module, const TBusSessionConfig& config) + : Module(module) + , Config(config) + , StartThread(_starter, this) + , Exiting(false) + { + StartThread.Start(); + } - TBusStarter::~TBusStarter() { - Shutdown(); - } + TBusStarter::~TBusStarter() { + Shutdown(); + } - void TBusStarter::Shutdown() { - { - TGuard<TMutex> g(ExitLock); - Exiting = true; - ExitSignal.Signal(); - } - StartThread.Join(); - } + void TBusStarter::Shutdown() { + { + TGuard<TMutex> g(ExitLock); + Exiting = true; + ExitSignal.Signal(); + } + StartThread.Join(); + } - void TBusStarter::Starter() { + void TBusStarter::Starter() { TGuard<TMutex> g(ExitLock); - while (!Exiting) { - TAutoPtr<TBusMessage> empty(new TBusMessage(0)); + while (!Exiting) { + TAutoPtr<TBusMessage> empty(new TBusMessage(0)); - EMessageStatus status = Module->StartJob(empty); + EMessageStatus status = Module->StartJob(empty); - if (Config.SendTimeout > 0) { - ExitSignal.WaitT(ExitLock, TDuration::MilliSeconds(Config.SendTimeout)); - } else { - ExitSignal.WaitT(ExitLock, (status == MESSAGE_BUSY) ? TDuration::MilliSeconds(1) : TDuration::Zero()); - } + if (Config.SendTimeout > 0) { + ExitSignal.WaitT(ExitLock, TDuration::MilliSeconds(Config.SendTimeout)); + } else { + ExitSignal.WaitT(ExitLock, (status == MESSAGE_BUSY) ? TDuration::MilliSeconds(1) : TDuration::Zero()); + } } } |