2 * @brief Models actions taken by threads.
12 #include "libatomic.h"
16 typedef enum action_type {
25 /* Forward declaration */
30 * 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() const { return tid; }
39 action_type get_type() const { return type; }
40 memory_order get_mo() const { return order; }
41 void * get_location() const { return location; }
42 int get_seq_number() const { return seq_number; }
44 Node * get_node() const { return node; }
45 void set_node(Node *n) { node = n; }
48 bool is_write() const;
50 bool is_acquire() const;
51 bool is_release() const;
52 bool is_seqcst() const;
53 bool same_var(const ModelAction *act) const;
54 bool same_thread(const ModelAction *act) const;
55 bool is_synchronizing(const ModelAction *act) const;
57 void create_cv(ModelAction *parent = NULL);
58 ClockVector * get_cv() const { return cv; }
59 void read_from(ModelAction *act);
61 inline bool operator <(const ModelAction& act) const {
62 return get_seq_number() < act.get_seq_number();
64 inline bool operator >(const ModelAction& act) const {
65 return get_seq_number() > act.get_seq_number();
71 /** Type of action (read, write, thread create, thread yield, thread join) */
74 /** The memory order for this operation. */
77 /** A pointer to the memory location for this action. */
80 /** The thread id that performed this action. */
83 /** The value read or written (if RMW, then the value written). This
84 * should probably be something longer. */
87 /** A back reference to a Node in NodeStack, if this ModelAction is
88 * saved on the NodeStack. */
93 /** The clock vector stored with this action; only needed if this
94 * action is a store release? */
98 typedef std::list<class ModelAction *> action_list_t;
100 #endif /* __ACTION_H__ */