Browse Source

Merge pull request #14906 from yashykt/lockfreeeventdoc

Add documentation for lockfree_event.h
Yash Tibrewal 7 years ago
parent
commit
cb078e5558
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/core/lib/iomgr/lockfree_event.h

+ 11 - 0
src/core/lib/iomgr/lockfree_event.h

@@ -42,12 +42,23 @@ class LockfreeEvent {
   void InitEvent();
   void DestroyEvent();
 
+  // Returns true if fd has been shutdown, false otherwise.
   bool IsShutdown() const {
     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);
+
+  // 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);
+
+  // Signals that the event has been received.
   void SetReady();
 
  private: