diff options
author | 2018-05-11 12:20:11 -0700 | |
---|---|---|
committer | 2018-05-11 12:20:11 -0700 | |
commit | 4fad281ce8affe27fb7428f264d2c3b9dfc45f2f (patch) | |
tree | ca96c9efd69afec56aa2e5fe072a9f758247d0a3 /src/core/lib/iomgr/lockfree_event.h | |
parent | ec445cc2bb270ed4acb1c710c3533fca14a50019 (diff) | |
parent | 61fdb46ac456027c79841949272ec540f66d2317 (diff) |
Merge remote-tracking branch 'upstream/master' into fork_exec_ctx_check
Diffstat (limited to 'src/core/lib/iomgr/lockfree_event.h')
-rw-r--r-- | src/core/lib/iomgr/lockfree_event.h | 13 |
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: |