diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-07-16 17:23:40 -0700 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-07-16 17:23:40 -0700 |
commit | abfaf2a5363aefdda8f5b311d1e46833aca06e53 (patch) | |
tree | 1c20204b5e006a5cc1c0e00615e56da73b156497 /src | |
parent | e0981dfa05e49acdd9fc5e8abb83a91d84d1a104 (diff) |
Expand comment
Diffstat (limited to 'src')
-rw-r--r-- | src/core/iomgr/pollset_posix.c | 12 |
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 |