Commit c175be23 authored by Martin Marinov's avatar Martin Marinov
Browse files

Add Progress::ActiveScope to define the scope in which a progress node is active.

parent 49b094cc
......@@ -56,6 +56,22 @@ private:
extern thread_local Node* actv_node; // active node
struct ActiveScope
{
Node* prnt_node;
ActiveScope(Node* _node)
: prnt_node(actv_node)
{
actv_node = _node;
}
~ActiveScope()
{
actv_node = prnt_node;
}
};
typedef Node* (*MakeNodeFunction)(Node* _next);
inline Node* make_children_list() { return nullptr; }
......@@ -101,10 +117,14 @@ inline Node* make_children_list(MakeNodeFunction _make_node_fnct,
(NODE)->tick(__FILE__, __PROGRESS_FUNCTION__); }
#define PROGRESS_ACTIVE_TICK PROGRESS_TICK(Progress::actv_node)
#define PROGRESS_ACTIVE_SCOPE(NAME, NODE) Progress::ActiveScope NAME = \
Progress::ActiveScope(Progress::PROGRESS_NODE_NAME(NODE))
#else
#define PROGRESS_DECLARE_NODE(OPRT)
#define PROGRESS_DEFINE_NODE(OPRT, ...)
#define PROGRESS_ACTIVE_SCOPE(NAME, NODE)
#endif// PROGRESS_ON
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment