X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=clockvector.h;h=f2716dbd90497c9f260b1730bee9d25bc9c622fd;hb=5fe0eea8bf392753f69ed8193a592b299a137e9c;hp=eb7086253d7f97e79b0f1d1ce41ef7b4e988e561;hpb=310276660b83b8dd313c512f07510268bcc1e3fc;p=c11tester.git diff --git a/clockvector.h b/clockvector.h index eb708625..f2716dbd 100644 --- a/clockvector.h +++ b/clockvector.h @@ -1,9 +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; @@ -11,14 +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(); + 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; };