diff options
author | leonidlazarev <leonidlazarev@yandex-team.com> | 2023-07-17 19:35:29 +0300 |
---|---|---|
committer | leonidlazarev <leonidlazarev@yandex-team.com> | 2023-07-17 19:35:29 +0300 |
commit | cb8e9a6330e4e5d9a0e2f8506e7469bbd641ec63 (patch) | |
tree | eddb7b81e7d1f5a7ac8078591799509e95572f4e /contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h | |
parent | 029cf29f3669091012394221f00dfa0f3631d91b (diff) | |
download | ydb-cb8e9a6330e4e5d9a0e2f8506e7469bbd641ec63.tar.gz |
feat grpc: update to grpc 1.53.1
update grpc to 1.53.1
update grpcio/py3 to 1.53.1
Added patches:
22-grpc-code-output.patch - allow translation of grpc code to internal string type.
23-max-thread-limitation.patch - to provide interface for settings of thread number limit, as
grpc::DynamicThreadPool doesn't provide interface to limit thread number anymore.
24-support_for-non-abort-grpc.patch - generate exception instead of application crash
25-forkable-destruction-order.patch - correct forkable logic for TimerManager
27-skip-child-post-fork-operations.patch - allow to skip child post fork operations to exclude UB (used for unified agent only)
pr33495_fox_nested_fork.patch - fix issues with nested forks
pr33582_fork_handler.patch - disable fork handler support if it is not requested intentionally
Diffstat (limited to 'contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h')
-rw-r--r-- | contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h | 81 |
1 files changed, 30 insertions, 51 deletions
diff --git a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h index 34de51a59c..30da5d1de5 100644 --- a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h +++ b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h @@ -1,66 +1,45 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H -#define GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H +// +// +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// + +#ifndef GRPC_SRC_CPP_SERVER_DYNAMIC_THREAD_POOL_H +#define GRPC_SRC_CPP_SERVER_DYNAMIC_THREAD_POOL_H #include <functional> -#include <list> -#include <queue> +#include <memory> + +#include <grpc/event_engine/event_engine.h> -#include "src/core/lib/gprpp/sync.h" -#include "src/core/lib/gprpp/thd.h" +#include "src/core/lib/event_engine/default_event_engine.h" #include "src/cpp/server/thread_pool_interface.h" namespace grpc { class DynamicThreadPool final : public ThreadPoolInterface { public: - explicit DynamicThreadPool(int reserve_threads); - ~DynamicThreadPool() override; - - void Add(const std::function<void()>& callback) override; + void Add(const std::function<void()>& callback) override { + event_engine_->Run(callback); + } private: - class DynamicThread { - public: - explicit DynamicThread(DynamicThreadPool* pool); - ~DynamicThread(); - - private: - DynamicThreadPool* pool_; - grpc_core::Thread thd_; - void ThreadFunc(); - }; - grpc_core::Mutex mu_; - grpc_core::CondVar cv_; - grpc_core::CondVar shutdown_cv_; - bool shutdown_; - std::queue<std::function<void()>> callbacks_; - int reserve_threads_; - int nthreads_; - int threads_waiting_; - std::list<DynamicThread*> dead_threads_; - - void ThreadFunc(); - static void ReapThreads(std::list<DynamicThread*>* tlist); + std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine_ = + grpc_event_engine::experimental::GetDefaultEventEngine(); }; } // namespace grpc -#endif // GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H +#endif // GRPC_SRC_CPP_SERVER_DYNAMIC_THREAD_POOL_H |