2 * @brief Models actions taken by threads.
12 #include "libatomic.h"
16 typedef enum action_type {
25 /* Forward declaration */
29 * The ModelAction class encapsulates an atomic action.
34 ModelAction(action_type_t type, memory_order order, void *loc, int value);
38 thread_id_t get_tid() { return tid; }
39 action_type get_type() { return type; }
40 memory_order get_mo() { return order; }
41 void * get_location() { return location; }
42 int get_seq_number() const { return seq_number; }
44 Node * get_node() { return node; }
45 void set_node(Node *n) { node = n; }
53 bool same_var(ModelAction *act);
54 bool same_thread(ModelAction *act);
55 bool is_synchronizing(ModelAction *act);
57 void create_cv(ModelAction *parent = NULL);
58 void read_from(ModelAction *act);
60 inline bool operator <(const ModelAction& act) const {
61 return get_seq_number() < act.get_seq_number();
63 inline bool operator >(const ModelAction& act) const {
64 return get_seq_number() > act.get_seq_number();
70 /** Type of action (read, write, thread create, thread yield, thread join) */
73 /** The memory order for this operation. */
76 /** A pointer to the memory location for this action. */
79 /** The thread id that performed this action. */
82 /** The value written. This should probably be something longer. */
89 /** The clock vector stored with this action if this action is a
95 typedef std::list<class ModelAction *> action_list_t;
97 #endif /* __ACTION_H__ */