pw_rpc: Switch PW_RPC_USE_GLOBAL_MUTEX to 1
Having locking disabled in RPC is a dangerous default. For example:
pw_transfer depends on RPC being reentrant.
Change-Id: I0a0406cc2cd66173b7b88ad27e7d1f5835aa837e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/94300
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Erik Gilling <konkers@google.com>
diff --git a/pw_rpc/BUILD.bazel b/pw_rpc/BUILD.bazel
index 3d911c8..a132124 100644
--- a/pw_rpc/BUILD.bazel
+++ b/pw_rpc/BUILD.bazel
@@ -115,6 +115,7 @@
"//pw_span",
"//pw_status",
"//pw_sync:lock_annotations",
+ "//pw_sync:mutex",
],
)
diff --git a/pw_rpc/docs.rst b/pw_rpc/docs.rst
index e58960a..920ec56 100644
--- a/pw_rpc/docs.rst
+++ b/pw_rpc/docs.rst
@@ -1178,7 +1178,7 @@
Enable global synchronization for RPC calls. If this is set, a backend must
be configured for pw_sync:mutex.
- This is disabled by default.
+ This is enabled by default.
.. c:macro:: PW_RPC_DYNAMIC_ALLOCATION
diff --git a/pw_rpc/public/pw_rpc/internal/config.h b/pw_rpc/public/pw_rpc/internal/config.h
index 42e4ebb..e9f3e74 100644
--- a/pw_rpc/public/pw_rpc/internal/config.h
+++ b/pw_rpc/public/pw_rpc/internal/config.h
@@ -46,7 +46,7 @@
// Enable global synchronization for RPC calls. If this is set, a backend must
// be configured for pw_sync:mutex.
#ifndef PW_RPC_USE_GLOBAL_MUTEX
-#define PW_RPC_USE_GLOBAL_MUTEX 0
+#define PW_RPC_USE_GLOBAL_MUTEX 1
#endif // PW_RPC_USE_GLOBAL_MUTEX
// Whether pw_rpc should use dynamic memory allocation internally. If enabled,