aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/surface/server.c
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2015-06-17 13:42:46 -0700
committerGravatar Vijay Pai <vpai@google.com>2015-06-17 13:42:46 -0700
commitd2a82d9da7dbe2759d7bdd400cc835229e904c07 (patch)
tree1cebd0a8d796370fc02b919018838df37a141d4d /src/core/surface/server.c
parent8931cdd29fa90fb27d2bad3f0aa03f3abf1ae923 (diff)
Added comments to describe nesting of mutexes
Diffstat (limited to 'src/core/surface/server.c')
-rw-r--r--src/core/surface/server.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/surface/server.c b/src/core/surface/server.c
index dac374b7d4..bb510b9ebf 100644
--- a/src/core/surface/server.c
+++ b/src/core/surface/server.c
@@ -141,8 +141,15 @@ struct grpc_server {
grpc_pollset **pollsets;
size_t cq_count;
- gpr_mu mu_global;
- gpr_mu mu_call;
+ /* The two following mutexes control access to server-state
+ mu_global controls access to non-call-related state (e.g., channel state)
+ mu_call controls access to call-related state (e.g., the call lists)
+
+ If they are ever required to be nested, you must lock mu_global
+ before mu_call. This is currently used in shutdown processing
+ (grpc_server_shutdown_and_notify and maybe_finish_shutdown) */
+ gpr_mu mu_global; /* mutex for server and channel state */
+ gpr_mu mu_call; /* mutex for call-specific state */
registered_method *registered_methods;
requested_call_array requested_calls;