aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test/core/client_config/set_initial_connect_string_test.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/core/client_config/set_initial_connect_string_test.c b/test/core/client_config/set_initial_connect_string_test.c
index 5b7f222f7a..c1b8452866 100644
--- a/test/core/client_config/set_initial_connect_string_test.c
+++ b/test/core/client_config/set_initial_connect_string_test.c
@@ -57,7 +57,7 @@ struct rpc_state {
gpr_slice_buffer incoming_buffer;
gpr_slice_buffer temp_incoming_buffer;
grpc_endpoint *tcp;
- int done;
+ gpr_atm done_atm;
};
static const char *magic_connect_string = "magic initial string";
@@ -70,7 +70,7 @@ static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
gpr_slice_buffer_move_into(&state.temp_incoming_buffer,
&state.incoming_buffer);
if (state.incoming_buffer.length > strlen(magic_connect_string)) {
- state.done = 1;
+ gpr_atm_rel_store(&state.done_atm, 1);
grpc_endpoint_shutdown(exec_ctx, state.tcp);
grpc_endpoint_destroy(exec_ctx, state.tcp);
} else {
@@ -117,7 +117,7 @@ static gpr_timespec n_sec_deadline(int seconds) {
}
static void start_rpc(int use_creds, int target_port) {
- state.done = 0;
+ gpr_atm_rel_store(&state.done_atm, 0);
state.cq = grpc_completion_queue_create(NULL);
if (use_creds) {
state.creds = grpc_fake_transport_security_credentials_create();
@@ -166,7 +166,7 @@ typedef struct {
static void actually_poll_server(void *arg) {
poll_args *pa = arg;
gpr_timespec deadline = n_sec_deadline(10);
- while (state.done == 0 &&
+ while (gpr_atm_acq_load(&state.done_atm) == 0 &&
gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0) {
test_tcp_server_poll(pa->server, 1);
}