Fix data race

pull/13311/head
Craig Tiller 7 years ago
parent fbf61bbc1a
commit 15626bb527
  1. 4
      src/core/lib/iomgr/lockfree_event.cc
  2. 4
      src/core/lib/iomgr/lockfree_event.h

@ -57,6 +57,10 @@ extern grpc_tracer_flag grpc_polling_trace;
namespace grpc_core {
LockfreeEvent::LockfreeEvent() {
gpr_atm_no_barrier_store(&state_, kClosureNotReady);
}
LockfreeEvent::~LockfreeEvent() {
gpr_atm curr = gpr_atm_no_barrier_load(&state_);
if (curr & kShutdownBit) {

@ -29,7 +29,7 @@ namespace grpc_core {
class LockfreeEvent {
public:
LockfreeEvent() = default;
LockfreeEvent();
~LockfreeEvent();
LockfreeEvent(const LockfreeEvent&) = delete;
@ -46,7 +46,7 @@ class LockfreeEvent {
private:
enum State { kClosureNotReady = 0, kClosureReady = 2, kShutdownBit = 1 };
gpr_atm state_ = kClosureNotReady;
gpr_atm state_;
};
} // namespace grpc_core

Loading…
Cancel
Save