diff options
author | Mark D. Roth <roth@google.com> | 2016-08-18 15:48:49 +0000 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2016-08-18 15:48:49 +0000 |
commit | 0c137e2e1f737d84e95805bf406a7f7e8938c065 (patch) | |
tree | 04850c4ee0fd1b9131e9cfb6e0f070772ffcff24 | |
parent | 2d7387cede74dc1be16b9336d5388daa30cfbda9 (diff) |
Fix tsan failures.
-rw-r--r-- | test/core/end2end/fixtures/http_proxy.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/core/end2end/fixtures/http_proxy.c b/test/core/end2end/fixtures/http_proxy.c index eb5ea0422f..b4c0dfba61 100644 --- a/test/core/end2end/fixtures/http_proxy.c +++ b/test/core/end2end/fixtures/http_proxy.c @@ -36,6 +36,7 @@ #include <string.h> #include <grpc/support/alloc.h> +#include <grpc/support/atm.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/slice_buffer.h> @@ -65,7 +66,7 @@ struct grpc_end2end_http_proxy { grpc_channel_args* channel_args; gpr_mu* mu; grpc_pollset* pollset; - bool shutdown; + gpr_atm shutdown; }; // @@ -376,7 +377,7 @@ static void thread_main(void* arg) { grpc_pollset_work(&exec_ctx, proxy->pollset, &worker, now, deadline)); gpr_mu_unlock(proxy->mu); grpc_exec_ctx_flush(&exec_ctx); - } while (!proxy->shutdown); + } while (!gpr_atm_acq_load(&proxy->shutdown)); grpc_exec_ctx_finish(&exec_ctx); } @@ -424,7 +425,7 @@ static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* arg, } void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy) { - proxy->shutdown = true; // Signal proxy thread to shutdown. + gpr_atm_rel_store(&proxy->shutdown, 1); // Signal proxy thread to shutdown. grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; gpr_thd_join(proxy->thd); grpc_tcp_server_shutdown_listeners(&exec_ctx, proxy->server); |