diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c index 3c35fcb89f3594f4ef243b337e090368d77c1730..9b4a2006a1fdf3d3b05cc16d367b9df8ac97af5f 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