8 #include "libthreads.h"
15 typedef enum action_type {
25 ModelAction(action_type_t type, memory_order order, void *loc, int value);
28 thread_id_t get_tid() { return tid; }
29 action_type get_type() { return type; }
30 memory_order get_mo() { return order; }
31 void *get_location() { return location; }
33 TreeNode *get_node() { return node; }
34 void set_node(TreeNode *n) { node = n; }
48 class Scheduler *scheduler;
49 Thread *system_thread;
51 void add_system_thread(Thread *t);
53 void set_current_action(ModelAction *act) { current_action = act; }
54 ModelAction *get_last_conflict(ModelAction *act);
55 void check_current_action(void);
56 void set_backtracking(ModelAction *act);
57 void print_trace(void);
59 int add_thread(Thread *t);
60 Thread *get_thread(thread_id_t tid) { return thread_map[tid]; }
62 void assign_id(Thread *t);
64 int switch_to_master(ModelAction *act);
67 class ModelAction *current_action;
68 std::list<class ModelAction *> action_trace;
69 std::map<thread_id_t, class Thread *> thread_map;
70 class TreeNode *rootNode, *currentNode;
73 extern ModelChecker *model;
75 int thread_switch_to_master(ModelAction *act);
77 #endif /* __MODEL_H__ */