#include <ScopedStackExecution.h>
A ScopedStackExecution object is placed after the agent lock is acquired, in each service transition and entry point. A static variable is used to track the call stack depth, incremented in each constructor, and decremented in each destructor.
In the constructor, a log message is printed if the stack level is 0, because a new event is beginning. In the destructor, a log message is printed if the stack level is 0, because the event is ending. Also, any deferred actions are executed at this point.
Finally, the scope level is exposed through a static method, so it may be inspected elsewhere.
Definition at line 104 of file ScopedStackExecution.h.
Public Member Functions | |
ScopedStackExecution () | |
Place this object after lock acquiring to mark the beginning of a transition or service entry point. | |
Static Public Member Functions | |
static void | addDefer (BaseMaceService *service) |
A service calls addDefer to indicate that when the call stack returns to 0, the service should have processDefered() called on it. | |
static void | runDefer () |
called when stack returns to 0 to execute deferred actions. Recurses in case deferred actions defer more actions. | |
static int | getStackDepth () |
returns the current stack depth. When called from a service executing an event, will return "here + 1", so 1 means top-level. |