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 void check_current_action(void);
55 void set_backtracking(ModelAction *act);
56 void print_trace(void);
58 int add_thread(Thread *t);
59 Thread *get_thread(thread_id_t tid) { return thread_map[tid]; }
61 void assign_id(Thread *t);
63 int switch_to_master(ModelAction *act);
66 class ModelAction *current_action;
67 std::list<class ModelAction *> action_trace;
68 std::map<thread_id_t, class Thread *> thread_map;
69 class TreeNode *rootNode, *currentNode;
72 extern ModelChecker *model;
74 int thread_switch_to_master(ModelAction *act);
76 #endif /* __MODEL_H__ */