Determine "enabled" by: was the thread created at this point. Checking against
num_threads is a naive way to do this...
{
TreeNode::totalNodes++;
this->parent = par;
+ if (!parent) {
+ num_threads = 1;
+ } else {
+ num_threads = parent->num_threads;
+ if (act && act->get_type() == THREAD_CREATE)
+ num_threads++;
+ }
}
TreeNode::~TreeNode() {
return parent->getRoot();
return this;
}
+
+bool TreeNode::is_enabled(Thread *t)
+{
+ return id_to_int(t->get_id()) < num_threads;
+}
int setBacktrack(thread_id_t id);
TreeNode * getRoot();
static int getTotalNodes() { return TreeNode::totalNodes; }
+
+ bool is_enabled(Thread *t);
private:
TreeNode *parent;
std::map<int, class TreeNode *> children;
std::set<int> backtrack;
static int totalNodes;
+ int num_threads;
};
#endif /* __TREE_H__ */