A stack-root represents the context of an event loop that is running some asynchronous work. The current async operation that is being executed by the event loop (if any) is pointed to by the 'topFrame'.
Declared in <folly/tracing/AsyncStack.h>
struct AsyncStackRoot;
If the current event loop is running nested inside some other event loop context then the 'nextRoot' points to the AsyncStackRoot context for the next event loop up the stack on the current thread.
The 'stackFramePtr' holds a pointer to the normal stack-frame that is currently executing this event loop. This allows reconciliation of the parts between a normal stack-trace and the start of the async-stack trace.
The current thread's top-most context (the head of the linked list of contexts) is obtained by calling getCurrentAsyncStackRoot().
| Name | Description |
|---|---|
AsyncStackRoot [constructor] | Constructors |
~AsyncStackRoot [destructor] | Destroys the stack root. |
operator= | Assignment operators |
getNextRoot | Returns the next event loop context lower on the current thread's stack. |
getReturnAddress | Returns the return address recorded for this stack root. |
getStackFramePointer | Returns the stack-frame pointer recorded for this stack root. |
getTopFrame | Returns the currently-active frame for this stack root. |
setNextRoot | Sets the next event loop context lower on the current thread's stack. |
setStackFrameContext | Initialises this stack root with information about the context in which the stack-root was declared. This records information about where the async-stack-trace should be spliced into the normal stack-trace. |
setTopFrame | Sets the top-frame to be 'frame' and also updates the cached 'frame.stackRoot' to be 'this'. |
| Name | Description |
|---|---|
folly::popAsyncStackFrameCallee | Pop the 'callee' frame off the stack, restoring the parent frame as the current frame. |
folly::checkAsyncStackFrameIsActive | Perform some consistency checks on the specified AsyncStackFrame, assuming that it is the currently active AsyncStackFrame. |
folly::pushAsyncStackFrameCallerCallee | Push the 'callee' frame onto the current thread's async stack, deactivating the 'caller' frame and setting up the 'caller' to be the parent-frame of the 'callee'. |
folly::deactivateAsyncStackFrame | Deactivate the specified AsyncStackFrame, clearing the current 'topFrame'. |
folly::activateAsyncStackFrame | Activate the specified AsyncStackFrame on the specified AsyncStackRoot, setting it as the current 'topFrame'. |
| Name | Description |
|---|---|
exchangeCurrentAsyncStackRoot | Exchange the current thread's active AsyncStackRoot with the specified AsyncStackRoot pointer, returning the old AsyncStackRoot pointer. |
getCurrentAsyncStackRoot | Get access to the current thread's top-most AsyncStackRoot. |
tryGetCurrentAsyncStackRoot | Get access to the current thread's top-most AsyncStackRoot. |