diff options
author | Nicolas Noble <nicolasnoble@users.noreply.github.com> | 2015-07-01 14:39:30 -0700 |
---|---|---|
committer | Nicolas Noble <nicolasnoble@users.noreply.github.com> | 2015-07-01 14:39:30 -0700 |
commit | a8c2d0259ffe26cfca731342a5553be3107a9936 (patch) | |
tree | b709a558ea8a18edfb5096025a82857f26143096 | |
parent | 0beaad3668622da2d7b2c17d6e0c7cca22124c31 (diff) | |
parent | 31231348e18e63dbda5673b54c7d39a7e8bfc703 (diff) |
Merge pull request #2281 from ctiller/and-he-told-us-of-his-life
Fix iomgr shutdown TSAN races
-rw-r--r-- | src/core/iomgr/fd_posix.c | 2 | ||||
-rw-r--r-- | src/core/iomgr/resolve_address_posix.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/core/iomgr/fd_posix.c b/src/core/iomgr/fd_posix.c index d12974cf3c..bcc11f91b7 100644 --- a/src/core/iomgr/fd_posix.c +++ b/src/core/iomgr/fd_posix.c @@ -74,6 +74,7 @@ static void freelist_fd(grpc_fd *fd) { gpr_mu_lock(&fd_freelist_mu); fd->freelist_next = fd_freelist; fd_freelist = fd; + grpc_iomgr_unregister_object(&fd->iomgr_object); gpr_mu_unlock(&fd_freelist_mu); } @@ -139,7 +140,6 @@ static void unref_by(grpc_fd *fd, int n) { #endif old = gpr_atm_full_fetch_add(&fd->refst, -n); if (old == n) { - grpc_iomgr_unregister_object(&fd->iomgr_object); freelist_fd(fd); } else { GPR_ASSERT(old > n); diff --git a/src/core/iomgr/resolve_address_posix.c b/src/core/iomgr/resolve_address_posix.c index 20d8c58eb4..dbf884c769 100644 --- a/src/core/iomgr/resolve_address_posix.c +++ b/src/core/iomgr/resolve_address_posix.c @@ -155,9 +155,9 @@ static void do_request(void *rp) { grpc_resolve_cb cb = r->cb; gpr_free(r->name); gpr_free(r->default_port); + cb(arg, resolved); grpc_iomgr_unregister_object(&r->iomgr_object); gpr_free(r); - cb(arg, resolved); } void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addrs) { |