diff options
| author | Anton Samokhvalov <[email protected]> | 2022-02-10 16:45:15 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:15 +0300 | 
| commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
| tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/messagebus/oldmodule/startsession.cpp | |
| parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
Restoring authorship annotation for Anton Samokhvalov <[email protected]>. Commit 1 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 7c38801d626..76171ba1d58 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());  +            }           }      }  | 
