#include "nodestack.h"
#include "action.h"
#include "common.h"
+#include "model.h"
int Node::total_nodes = 0;
-Node::Node(ModelAction *act, Node *parent)
+Node::Node(ModelAction *act, int nthreads)
: action(act),
- num_threads(parent ? parent->num_threads : 1),
+ num_threads(nthreads),
explored_children(num_threads),
backtrack(num_threads)
{
total_nodes++;
- if (act && act->get_type() == THREAD_CREATE) {
- num_threads++;
- explored_children.resize(num_threads);
- backtrack.resize(num_threads);
- }
}
Node::~Node()
/* Record action */
get_head()->explore_child(act);
act->create_cv(get_head()->get_action());
- node_list.push_back(new Node(act, get_head()));
+ node_list.push_back(new Node(act, model->get_num_threads()));
iter++;
}
return (*iter)->get_action();
class Node {
public:
- Node(ModelAction *act = NULL, Node *parent = NULL);
+ Node(ModelAction *act = NULL, int nthreads = 1);
~Node();
/* return true = thread choice has already been explored */
bool has_been_explored(thread_id_t tid);