Skip to content

Commit

Permalink
pw_rpc: Provide option for disabling the mutex
Browse files Browse the repository at this point in the history
- 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 <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
  • Loading branch information
255 authored and CQ Bot Account committed May 27, 2022
1 parent bc08f73 commit 6ac788c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
15 changes: 13 additions & 2 deletions pw_rpc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
Expand Down
2 changes: 0 additions & 2 deletions pw_system/system_target.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion targets/host/target_toolchains.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6ac788c

Please sign in to comment.