aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/lockfree_event.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/iomgr/lockfree_event.h')
-rw-r--r--src/core/lib/iomgr/lockfree_event.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/lib/iomgr/lockfree_event.h b/src/core/lib/iomgr/lockfree_event.h
index 83de656f5f..d6a6c226bc 100644
--- a/src/core/lib/iomgr/lockfree_event.h
+++ b/src/core/lib/iomgr/lockfree_event.h
@@ -25,7 +25,7 @@
#include <grpc/support/atm.h>
-#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/closure.h"
namespace grpc_core {
@@ -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: