9 #include "libthreads.h"
10 #include "libatomic.h"
16 typedef enum action_type {
24 typedef std::list<class ModelAction *> action_list_t;
28 ModelAction(action_type_t type, memory_order order, void *loc, int value);
31 thread_id_t get_tid() { return tid; }
32 action_type get_type() { return type; }
33 memory_order get_mo() { return order; }
34 void *get_location() { return location; }
36 TreeNode *get_node() { return node; }
37 void set_node(TreeNode *n) { node = n; }
49 Backtrack(ModelAction *d, action_list_t *t) {
52 //currentIterator = actionTrace->getFirst();
54 ModelAction *get_diverge() { return diverge; }
55 action_list_t *get_trace() { return actionTrace; }
58 /* unused for now; will be used when re-exploring this path? */
59 //MyListElement *currentIterator;
60 action_list_t *actionTrace;
67 class Scheduler *scheduler;
68 Thread *system_thread;
70 void add_system_thread(Thread *t);
72 void set_current_action(ModelAction *act) { current_action = act; }
73 ModelAction *get_last_conflict(ModelAction *act);
74 void check_current_action(void);
75 void set_backtracking(ModelAction *act);
76 void print_trace(void);
78 int add_thread(Thread *t);
79 Thread *get_thread(thread_id_t tid) { return thread_map[tid]; }
81 void assign_id(Thread *t);
83 int switch_to_master(ModelAction *act);
86 class ModelAction *current_action;
87 action_list_t *action_trace;
88 std::map<thread_id_t, class Thread *> thread_map;
89 class TreeNode *rootNode, *currentNode;
90 std::list<class Backtrack *> backtrack_list;
93 extern ModelChecker *model;
95 int thread_switch_to_master(ModelAction *act);
97 #endif /* __MODEL_H__ */