GRPC Core
9.0.0
|
Application-callback execution context. More...
#include <exec_ctx.h>
Public Member Functions | |
ApplicationCallbackExecCtx () | |
Default Constructor. More... | |
ApplicationCallbackExecCtx (uintptr_t fl) | |
Parameterised Constructor. More... | |
~ApplicationCallbackExecCtx () | |
Static Public Member Functions | |
static void | Set (ApplicationCallbackExecCtx *exec_ctx, uintptr_t flags) |
static void | Enqueue (grpc_experimental_completion_queue_functor *functor, int is_success) |
static void | GlobalInit (void) |
Global initialization for ApplicationCallbackExecCtx. More... | |
static void | GlobalShutdown (void) |
Global shutdown for ApplicationCallbackExecCtx. More... | |
Application-callback execution context.
A bag of data that collects information along a callstack. It is created on the stack at core entry points, and stored internally as a thread-local variable.
There are three key differences between this structure and ExecCtx:
This structure exists because application callbacks may themselves cause a core re-entry (e.g., through a public API call) and if that call in turn causes another application-callback, there could be arbitrarily growing stacks of core re-entries. Instead, any application callbacks instead should not be invoked until other core work is done and other application callbacks have completed. To accomplish this, any application callback should be enqueued using grpc_core::ApplicationCallbackExecCtx::Enqueue .
CONVENTIONS:
Generally, core entry points that may trigger application-level callbacks will have the following declarations:
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ExecCtx exec_ctx;
This ordering is important to make sure that the ApplicationCallbackExecCtx is destroyed after the ExecCtx (to prevent the re-entry problem described above, as well as making sure that ExecCtx core callbacks are invoked first)
|
inline |
Default Constructor.
|
inline |
Parameterised Constructor.
|
inline |
|
inlinestatic |
|
inlinestatic |
Global initialization for ApplicationCallbackExecCtx.
Called by init.
|
inlinestatic |
Global shutdown for ApplicationCallbackExecCtx.
Called by init.
|
inlinestatic |