X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=clockvector.h;h=f2716dbd90497c9f260b1730bee9d25bc9c622fd;hb=ec01a46ce69f58f219b59a4148bc833cd5aa07c6;hp=615dfeb7e83196dff11213ed589ceaaadc7b2196;hpb=1517deafbf0cb93bfc14b4bb40609af63ccf8417;p=c11tester.git diff --git a/clockvector.h b/clockvector.h index 615dfeb7..f2716dbd 100644 --- a/clockvector.h +++ b/clockvector.h @@ -1,8 +1,14 @@ +/** @file clockvector.h + * @brief Implements a clock vector. + */ + #ifndef __CLOCKVECTOR_H__ #define __CLOCKVECTOR_H__ #include "threads.h" +#include "mymemory.h" +typedef unsigned int modelclock_t; /* Forward declaration */ class ModelAction; @@ -10,10 +16,19 @@ class ClockVector { public: ClockVector(ClockVector *parent = NULL, ModelAction *act = NULL); ~ClockVector(); - void merge(ClockVector *cv); - bool happens_before(ModelAction *act, thread_id_t id); + void merge(const ClockVector *cv); + bool synchronized_since(const ModelAction *act) const; + bool has_synchronized_with(const ClockVector *cv) const; + + void print() const; + modelclock_t getClock(thread_id_t thread); + + MEMALLOC private: - int *clock; + /** @brief Holds the actual clock data, as an array. */ + modelclock_t *clock; + + /** @brief The number of threads recorded in clock (i.e., its length). */ int num_threads; };