Skip to content
Snippets Groups Projects
Commit 23139ae2 authored by Craig Tiller's avatar Craig Tiller
Browse files

Add checking on fd_posix refcounts

parent 44f77a3e
No related branches found
No related tags found
No related merge requests found
......@@ -104,14 +104,17 @@ static void destroy(grpc_fd *fd) {
}
static void ref_by(grpc_fd *fd, int n) {
gpr_atm_no_barrier_fetch_add(&fd->refst, n);
GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&fd->refst, n) > 0);
}
static void unref_by(grpc_fd *fd, int n) {
if (gpr_atm_full_fetch_add(&fd->refst, -n) == n) {
gpr_atm old = gpr_atm_full_fetch_add(&fd->refst, -n);
if (old == n) {
grpc_iomgr_add_callback(fd->on_done, fd->on_done_user_data);
freelist_fd(fd);
grpc_iomgr_unref();
} else {
GPR_ASSERT(old > n);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment