diff options
author | Alexander Smirnov <alex@ydb.tech> | 2025-04-04 08:10:14 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2025-04-04 08:10:14 +0000 |
commit | 93e24a1b2003b226c26d4d24c4038df3c441897c (patch) | |
tree | 02b24e1074c609f2633c5e6282ca227f8cd77fe5 /library/cpp/neh/http2.cpp | |
parent | 874f495f0ca11e54980e7120837b8504b393009b (diff) | |
parent | 099240b6b9d598e1178351c4324de0bae80ae98a (diff) | |
download | ydb-93e24a1b2003b226c26d4d24c4038df3c441897c.tar.gz |
Merge branch 'rightlib' into merge-libs-250404-0808
Diffstat (limited to 'library/cpp/neh/http2.cpp')
-rw-r--r-- | library/cpp/neh/http2.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/library/cpp/neh/http2.cpp b/library/cpp/neh/http2.cpp index f10fdc3b3e..daf73ba0d1 100644 --- a/library/cpp/neh/http2.cpp +++ b/library/cpp/neh/http2.cpp @@ -912,7 +912,6 @@ namespace { THttpConnManager() : TotalConn(0) , EP_(THttp2Options::AsioThreads) - , InPurging_(0) , MaxConnId_(0) , Shutdown_(false) { @@ -1011,7 +1010,7 @@ namespace { } void SuggestPurgeCache() { - if (AtomicTryLock(&InPurging_)) { + if (InPurging_.TryAcquire()) { //evaluate the usefulness of purging the cache //если в кеше мало соединений (< MaxConnId_/16 или 64), не чистим кеш if (Cache_.Size() > (Min((size_t)AtomicGet(MaxConnId_), (size_t)1024U) >> 4)) { @@ -1031,7 +1030,7 @@ namespace { return; //memo: thread MUST unlock InPurging_ (see DoExecute()) } } - AtomicUnlock(&InPurging_); + InPurging_.Release(); } } @@ -1049,7 +1048,7 @@ namespace { PurgeCache(); - AtomicUnlock(&InPurging_); + InPurging_.Release(); } } @@ -1076,7 +1075,7 @@ namespace { TExecutorsPool EP_; TConnCache<THttpConn> Cache_; - TAtomic InPurging_; + TSpinLock InPurging_; TAtomic MaxConnId_; TAutoPtr<IThreadFactory::IThread> T_; |