From ad4045191526654aa0dfef979299ad43a452147e Mon Sep 17 00:00:00 2001 From: dennycd Date: Tue, 24 Dec 2024 00:07:50 +0000 Subject: [PATCH] Native source sync at revision @c7cb8a8 --- gRPC-C++.podspec | 2 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- src/core/lib/promise/activity.cc | 2 ++ src/core/lib/promise/activity.h | 25 +++++++++++++------ .../plugin_registry/grpc_plugin_registry.cc | 2 -- .../grpc_plugin_registry_extra.cc | 2 ++ 9 files changed, 27 insertions(+), 14 deletions(-) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index a4c2d150b..fce1a51a5 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -69,7 +69,7 @@ Pod::Spec.new do |s| # build. 'USE_HEADERMAP' => 'NO', 'ALWAYS_SEARCH_USER_PATHS' => 'NO', - 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14', + 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17', } s.libraries = 'c++' diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 2c75a8f11..9572e37cb 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -89,7 +89,7 @@ Pod::Spec.new do |s| 'ALWAYS_SEARCH_USER_PATHS' => 'NO', 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1"', 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', - 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14', + 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17', } s.default_subspecs = 'Interface', 'Implementation' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 9f83832e4..fbed4a179 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -85,6 +85,6 @@ Pod::Spec.new do |s| # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', - 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14', + 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17', } end diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index ae6c77f29..23c1720dc 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -67,6 +67,6 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', - 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14', + 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17', } end diff --git a/gRPC.podspec b/gRPC.podspec index 7c44ecd85..41c811541 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', - 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14', + 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17', } s.ios.deployment_target = '11.0' diff --git a/src/core/lib/promise/activity.cc b/src/core/lib/promise/activity.cc index 1a0a52d7b..5c067f46c 100644 --- a/src/core/lib/promise/activity.cc +++ b/src/core/lib/promise/activity.cc @@ -30,7 +30,9 @@ namespace grpc_core { /////////////////////////////////////////////////////////////////////////////// // GLOBALS +#if !defined(_WIN32) || !defined(_DLL) thread_local Activity* Activity::g_current_activity_{nullptr}; +#endif namespace promise_detail { diff --git a/src/core/lib/promise/activity.h b/src/core/lib/promise/activity.h index b635286cb..37cfc8dc8 100644 --- a/src/core/lib/promise/activity.h +++ b/src/core/lib/promise/activity.h @@ -215,7 +215,7 @@ class Activity : public Orphanable { // locked // - back up that assertion with a runtime check in debug builds (it's // prohibitively expensive in non-debug builds) - static Activity* current() { return g_current_activity_; } + static Activity* current() { return current_ref(); } // Produce an activity-owning Waker. The produced waker will keep the activity // alive until it's awoken or dropped. @@ -232,17 +232,16 @@ class Activity : public Orphanable { protected: // Check if this activity is the current activity executing on the current // thread. - bool is_current() const { return this == g_current_activity_; } + bool is_current() const { return this == current(); } // Check if there is an activity executing on the current thread. - static bool have_current() { return g_current_activity_ != nullptr; } + static bool have_current() { return current() != nullptr; } // Set the current activity at construction, clean it up at destruction. class ScopedActivity { public: - explicit ScopedActivity(Activity* activity) - : prior_activity_(g_current_activity_) { - g_current_activity_ = activity; + explicit ScopedActivity(Activity* activity) : prior_activity_(current()) { + current_ref() = activity; } - ~ScopedActivity() { g_current_activity_ = prior_activity_; } + ~ScopedActivity() { current_ref() = prior_activity_; } ScopedActivity(const ScopedActivity&) = delete; ScopedActivity& operator=(const ScopedActivity&) = delete; @@ -251,9 +250,21 @@ class Activity : public Orphanable { }; private: + static Activity*& current_ref() { +#if !defined(_WIN32) || !defined(_DLL) + return g_current_activity_; +#else + // Set during RunLoop to the Activity that's executing. + // Being set implies that mu_ is held. + static thread_local Activity* current_activity; + return current_activity; +#endif + } +#if !defined(_WIN32) || !defined(_DLL) // Set during RunLoop to the Activity that's executing. // Being set implies that mu_ is held. static thread_local Activity* g_current_activity_; +#endif }; // Owned pointer to one Activity. diff --git a/src/core/plugin_registry/grpc_plugin_registry.cc b/src/core/plugin_registry/grpc_plugin_registry.cc index a276ea922..4970e2a01 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_plugin_registry.cc @@ -62,7 +62,6 @@ extern void RegisterOutlierDetectionLbPolicy( CoreConfiguration::Builder* builder); extern void RegisterWeightedTargetLbPolicy(CoreConfiguration::Builder* builder); extern void RegisterPickFirstLbPolicy(CoreConfiguration::Builder* builder); -extern void RegisterRingHashLbPolicy(CoreConfiguration::Builder* builder); extern void RegisterRoundRobinLbPolicy(CoreConfiguration::Builder* builder); extern void RegisterWeightedRoundRobinLbPolicy( CoreConfiguration::Builder* builder); @@ -103,7 +102,6 @@ void BuildCoreConfiguration(CoreConfiguration::Builder* builder) { RegisterWeightedTargetLbPolicy(builder); RegisterPickFirstLbPolicy(builder); RegisterRoundRobinLbPolicy(builder); - RegisterRingHashLbPolicy(builder); RegisterWeightedRoundRobinLbPolicy(builder); BuildClientChannelConfiguration(builder); SecurityRegisterHandshakerFactories(builder); diff --git a/src/core/plugin_registry/grpc_plugin_registry_extra.cc b/src/core/plugin_registry/grpc_plugin_registry_extra.cc index 7854b5154..aa91cba24 100644 --- a/src/core/plugin_registry/grpc_plugin_registry_extra.cc +++ b/src/core/plugin_registry/grpc_plugin_registry_extra.cc @@ -37,6 +37,7 @@ extern void RegisterCdsLbPolicy(CoreConfiguration::Builder* builder); extern void RegisterXdsOverrideHostLbPolicy( CoreConfiguration::Builder* builder); extern void RegisterXdsWrrLocalityLbPolicy(CoreConfiguration::Builder* builder); +extern void RegisterRingHashLbPolicy(CoreConfiguration::Builder* builder); extern void RegisterFileWatcherCertificateProvider( CoreConfiguration::Builder* builder); extern void RegisterXdsHttpProxyMapper(CoreConfiguration::Builder* builder); @@ -59,6 +60,7 @@ void RegisterExtraFilters(CoreConfiguration::Builder* builder) { RegisterCdsLbPolicy(builder); RegisterXdsOverrideHostLbPolicy(builder); RegisterXdsWrrLocalityLbPolicy(builder); + RegisterRingHashLbPolicy(builder); RegisterFileWatcherCertificateProvider(builder); RegisterXdsHttpProxyMapper(builder); #endif