From 6ac788cec84082d5fab0b25c2d8f5594d1ce502a Mon Sep 17 00:00:00 2001 From: Wyatt Hepler Date: Tue, 24 May 2022 14:16:08 -0700 Subject: [PATCH] pw_rpc: Provide option for disabling the mutex - Provide a config that disable the global mutex for pw_rpc to simplify changing that setting from GN. - Remove uses of pw_rpc:use_global_mutex since the global mutex is enabled by default now. Change-Id: I80f8db797b8fc1141d85a8970425e22b6aa6a06e Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/95844 Pigweed-Auto-Submit: Wyatt Hepler Commit-Queue: Auto-Submit Reviewed-by: Rob Mohr --- pw_rpc/BUILD.gn | 15 +++++++++++++-- pw_system/system_target.gni | 2 -- targets/host/target_toolchains.gni | 1 - 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pw_rpc/BUILD.gn b/pw_rpc/BUILD.gn index 4b8a7b35b2..3be85573d7 100644 --- a/pw_rpc/BUILD.gn +++ b/pw_rpc/BUILD.gn @@ -31,13 +31,24 @@ config("public_include_path") { visibility = [ ":*" ] } +config("disable_global_mutex_config") { + defines = [ "PW_RPC_USE_GLOBAL_MUTEX=0" ] + visibility = [ ":*" ] +} + +# Set pw_rpc_CONFIG to this to disable the global mutex. If additional options +# are needed, a config target that sets those can depend on this. +group("disable_global_mutex") { + public_configs = [ ":disable_global_mutex_config" ] +} + config("global_mutex_config") { defines = [ "PW_RPC_USE_GLOBAL_MUTEX=1" ] visibility = [ ":*" ] } -# Set pw_rpc_CONFIG to this to enable the global mutex. If additional options -# are needed, a config target that sets those can depend on this. +# Set pw_rpc_CONFIG to this to always enable the global mutex. The mutex is +# enabled by default, so this is a no-op. group("use_global_mutex") { public_configs = [ ":global_mutex_config" ] } diff --git a/pw_system/system_target.gni b/pw_system/system_target.gni index 8fe9d431de..ecef0bd0ca 100644 --- a/pw_system/system_target.gni +++ b/pw_system/system_target.gni @@ -106,8 +106,6 @@ template("pw_system_target") { # is added. pw_log_BACKEND = dir_pw_log_basic - pw_rpc_CONFIG = "$dir_pw_rpc:use_global_mutex" - # TODO(amontanez): This should be set to a "$dir_pw_unit_test:rpc_main" # when RPC is working. pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" diff --git a/targets/host/target_toolchains.gni b/targets/host/target_toolchains.gni index 15c08acb49..2a79974de6 100644 --- a/targets/host/target_toolchains.gni +++ b/targets/host/target_toolchains.gni @@ -55,7 +55,6 @@ _host_common = { # Configure backend for pw_rpc_system_server. pw_rpc_system_server_BACKEND = "$dir_pigweed/targets/host:system_rpc_server" - pw_rpc_CONFIG = "$dir_pw_rpc:use_global_mutex" # Configure backend for trace facade. pw_trace_BACKEND = "$dir_pw_trace_tokenized"