aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-03-13 15:27:43 -0700
committerGravatar GitHub <noreply@github.com>2018-03-13 15:27:43 -0700
commit21a64df89739229b0befe5bef1edd731676619bb (patch)
tree5a15d81e953a8721a07c3b246325b4be1cd832c6 /src/core/lib/iomgr
parentb62d77f05b158291061637984e0197475c3e8f1a (diff)
parentfc9c0705b3bd39ad32a002beb4d7b584042a7c11 (diff)
Merge pull request #14694 from yashykt/execctxdesc
Update documentation for ExecCtx
Diffstat (limited to 'src/core/lib/iomgr')
-rw-r--r--src/core/lib/iomgr/exec_ctx.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/core/lib/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h
index de97164f02..678ca1e5ac 100644
--- a/src/core/lib/iomgr/exec_ctx.h
+++ b/src/core/lib/iomgr/exec_ctx.h
@@ -54,23 +54,32 @@ grpc_millis grpc_timespec_to_millis_round_up(gpr_timespec timespec);
namespace grpc_core {
/** Execution context.
* A bag of data that collects information along a callstack.
- * Generally created at public API entry points, and passed down as
- * pointer to child functions that manipulate it.
+ * It is created on the stack at public API entry points, and stored internally
+ * as a thread-local variable.
+ *
+ * Generally, to create an exec_ctx instance, add the following line at the top
+ * of the public API entry point or at the start of a thread's work function :
+ *
+ * grpc_core::ExecCtx exec_ctx;
+ *
+ * Access the created ExecCtx instance using :
+ * grpc_core::ExecCtx::Get()
*
* Specific responsibilities (this may grow in the future):
* - track a list of work that needs to be delayed until the top of the
* call stack (this provides a convenient mechanism to run callbacks
* without worrying about locking issues)
- * - provide a decision maker (via grpc_exec_ctx_ready_to_finish) that provides
+ * - provide a decision maker (via IsReadyToFinish) that provides a
* signal as to whether a borrowed thread should continue to do work or
* should actively try to finish up and get this thread back to its owner
*
* CONVENTIONS:
* - Instance of this must ALWAYS be constructed on the stack, never
* heap allocated.
- * - Instances and pointers to them must always be called exec_ctx.
- * - Instances are always passed as the first argument to a function that
- * takes it, and always as a pointer (grpc_exec_ctx is never copied).
+ * - Exactly one instance of ExecCtx must be created per thread. Instances must
+ * always be called exec_ctx.
+ * - Do not pass exec_ctx as a parameter to a function. Always access it using
+ * grpc_core::ExecCtx::Get()
*/
class ExecCtx {
public: