8 #include "libthreads.h"
15 typedef enum action_type {
23 typedef std::list<class ModelAction *> action_list_t;
27 ModelAction(action_type_t type, memory_order order, void *loc, int value);
30 thread_id_t get_tid() { return tid; }
31 action_type get_type() { return type; }
32 memory_order get_mo() { return order; }
33 void *get_location() { return location; }
35 TreeNode *get_node() { return node; }
36 void set_node(TreeNode *n) { node = n; }
48 Backtrack(ModelAction *d, action_list_t *t) {
51 //currentIterator = actionTrace->getFirst();
53 ModelAction *get_diverge() { return diverge; }
54 action_list_t *get_trace() { return actionTrace; }
57 /* unused for now; will be used when re-exploring this path? */
58 //MyListElement *currentIterator;
59 action_list_t *actionTrace;
66 class Scheduler *scheduler;
67 Thread *system_thread;
69 void add_system_thread(Thread *t);
71 void set_current_action(ModelAction *act) { current_action = act; }
72 ModelAction *get_last_conflict(ModelAction *act);
73 void check_current_action(void);
74 void set_backtracking(ModelAction *act);
75 void print_trace(void);
77 int add_thread(Thread *t);
78 Thread *get_thread(thread_id_t tid) { return thread_map[tid]; }
80 void assign_id(Thread *t);
82 int switch_to_master(ModelAction *act);
85 class ModelAction *current_action;
86 action_list_t *action_trace;
87 std::map<thread_id_t, class Thread *> thread_map;
88 class TreeNode *rootNode, *currentNode;
89 std::list<class Backtrack *> backtrack_list;
92 extern ModelChecker *model;
94 int thread_switch_to_master(ModelAction *act);
96 #endif /* __MODEL_H__ */