Add documentation for lockfree_event.h

pull/14906/head
Yash Tibrewal 7 years ago
parent 0b49467404
commit a324bd5a35
  1. 11
      src/core/lib/iomgr/lockfree_event.h

@ -42,12 +42,23 @@ class LockfreeEvent {
void InitEvent(); void InitEvent();
void DestroyEvent(); void DestroyEvent();
// Returns true if fd has been shutdown, false otherwise.
bool IsShutdown() const { bool IsShutdown() const {
return (gpr_atm_no_barrier_load(&state_) & kShutdownBit) != 0; return (gpr_atm_no_barrier_load(&state_) & kShutdownBit) != 0;
} }
// Schedules \a closure when the event is received (see SetReady()) or the
// shutdown state has been set. Note that the event may have already been
// received, in which case the closure would be scheduled immediately.
// If the shutdown state has already been set, then \a closure is scheduled
// with the shutdown error.
void NotifyOn(grpc_closure* closure); void NotifyOn(grpc_closure* closure);
// Sets the shutdown state. If a closure had been provided by NotifyOn and has
// not yet been scheduled, it will be scheduled with \a error.
bool SetShutdown(grpc_error* error); bool SetShutdown(grpc_error* error);
// Signals that the event has been received.
void SetReady(); void SetReady();
private: private:

Loading…
Cancel
Save