diff options
author | and42 <and42@yandex-team.ru> | 2022-02-10 16:47:12 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:12 +0300 |
commit | 984590e9d9d7c0f912885d93ae78be402ae7b4f4 (patch) | |
tree | 339adc63bce23800021202ae4a8328a843dc447a /library/cpp/dns/thread.cpp | |
parent | 4fc9a1a64db469cc94894abfec740aa5c9e9789b (diff) | |
download | ydb-984590e9d9d7c0f912885d93ae78be402ae7b4f4.tar.gz |
Restoring authorship annotation for <and42@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/dns/thread.cpp')
-rw-r--r-- | library/cpp/dns/thread.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/dns/thread.cpp b/library/cpp/dns/thread.cpp index d091b0f144a..8b27d2d527c 100644 --- a/library/cpp/dns/thread.cpp +++ b/library/cpp/dns/thread.cpp @@ -1,27 +1,27 @@ -#include "thread.h" - +#include "thread.h" + #include "magic.h" -#include <util/network/socket.h> +#include <util/network/socket.h> #include <util/thread/factory.h> -#include <util/thread/lfqueue.h> -#include <util/system/event.h> +#include <util/thread/lfqueue.h> +#include <util/system/event.h> #include <util/generic/vector.h> -#include <util/generic/singleton.h> +#include <util/generic/singleton.h> -using namespace NDns; +using namespace NDns; namespace { class TThreadedResolver: public IThreadFactory::IThreadAble, public TNonCopyable { struct TResolveRequest { inline TResolveRequest(const TString& host, ui16 port) - : Host(host) - , Port(port) + : Host(host) + , Port(port) { } - inline TNetworkAddressPtr Wait() { - E.Wait(); + inline TNetworkAddressPtr Wait() { + E.Wait(); if (!Error) { if (!Result) { @@ -38,7 +38,7 @@ namespace { inline void Resolve() noexcept { try { - Result = new TNetworkAddress(Host, Port); + Result = new TNetworkAddress(Host, Port); } catch (...) { Error = SaveError(); } @@ -47,20 +47,20 @@ namespace { } inline void Wake() noexcept { - E.Signal(); + E.Signal(); } TString Host; - ui16 Port; + ui16 Port; TManualEvent E; - TNetworkAddressPtr Result; + TNetworkAddressPtr Result; IErrorRef Error; }; public: - inline TThreadedResolver() + inline TThreadedResolver() : E_(TSystemEvent::rAuto) - { + { T_.push_back(SystemThreadFactory()->Run(this)); } @@ -87,7 +87,7 @@ namespace { } inline TNetworkAddressPtr Resolve(const TString& host, ui16 port) { - TResolveRequest rr(host, port); + TResolveRequest rr(host, port); Schedule(&rr); @@ -124,10 +124,10 @@ namespace { typedef TAutoPtr<IThreadFactory::IThread> IThreadRef; TVector<IThreadRef> T_; }; -} +} -namespace NDns { +namespace NDns { TNetworkAddressPtr ThreadedResolve(const TString& host, ui16 port) { - return TThreadedResolver::Instance()->Resolve(host, port); + return TThreadedResolver::Instance()->Resolve(host, port); } } |