aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/iomgr/pollset_posix.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-07-16 17:23:40 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-07-16 17:23:40 -0700
commitabfaf2a5363aefdda8f5b311d1e46833aca06e53 (patch)
tree1c20204b5e006a5cc1c0e00615e56da73b156497 /src/core/iomgr/pollset_posix.c
parente0981dfa05e49acdd9fc5e8abb83a91d84d1a104 (diff)
Expand comment
Diffstat (limited to 'src/core/iomgr/pollset_posix.c')
-rw-r--r--src/core/iomgr/pollset_posix.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index 3c35fcb89f..9b4a2006a1 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -106,8 +106,11 @@ void grpc_pollset_init(grpc_pollset *pollset) {
void grpc_pollset_add_fd(grpc_pollset *pollset, grpc_fd *fd) {
gpr_mu_lock(&pollset->mu);
pollset->vtable->add_fd(pollset, fd, 1);
+ /* the following (enabled only in debug) will reacquire and then releast
+ our lock - meaning that if the unlocking flag passed to del_fd above is
+ not respected, the code will deadlock (in a way that we have a chance of
+ debugging) */
#ifndef NDEBUG
- /* this will deadlock if the unlocking rules aren't correctly implemented */
gpr_mu_lock(&pollset->mu);
gpr_mu_unlock(&pollset->mu);
#endif
@@ -116,8 +119,11 @@ void grpc_pollset_add_fd(grpc_pollset *pollset, grpc_fd *fd) {
void grpc_pollset_del_fd(grpc_pollset *pollset, grpc_fd *fd) {
gpr_mu_lock(&pollset->mu);
pollset->vtable->del_fd(pollset, fd, 1);
-#ifndef NDEBUG
- /* this will deadlock if the unlocking rules aren't correctly implemented */
+ /* the following (enabled only in debug) will reacquire and then releast
+ our lock - meaning that if the unlocking flag passed to del_fd above is
+ not respected, the code will deadlock (in a way that we have a chance of
+ debugging) */
+#ifndef NDEBUG
gpr_mu_lock(&pollset->mu);
gpr_mu_unlock(&pollset->mu);
#endif