Merge pull request #14233 from jtattermusch/settings_timeout_test_race

Tentative fix for EventState::done() data race
pull/14238/head
Jan Tattermusch 7 years ago committed by GitHub
commit 486a619af2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      test/core/transport/chttp2/settings_timeout_test.cc

@ -169,7 +169,7 @@ class Client {
grpc_closure* closure() { return &closure_; } grpc_closure* closure() { return &closure_; }
bool done() const { return done_; } bool done() const { return gpr_atm_acq_load(&done_atm_) != 0; }
// Caller does NOT take ownership of the error. // Caller does NOT take ownership of the error.
grpc_error* error() const { return error_; } grpc_error* error() const { return error_; }
@ -179,11 +179,11 @@ class Client {
gpr_log(GPR_INFO, "OnEventDone(): %s", grpc_error_string(error)); gpr_log(GPR_INFO, "OnEventDone(): %s", grpc_error_string(error));
EventState* state = (EventState*)arg; EventState* state = (EventState*)arg;
state->error_ = GRPC_ERROR_REF(error); state->error_ = GRPC_ERROR_REF(error);
state->done_ = true; gpr_atm_rel_store(&state->done_atm_, 1);
} }
grpc_closure closure_; grpc_closure closure_;
bool done_ = false; gpr_atm done_atm_ = 0;
grpc_error* error_ = GRPC_ERROR_NONE; grpc_error* error_ = GRPC_ERROR_NONE;
}; };

Loading…
Cancel
Save