Merge branch 'norris'
[model-checker.git] / promise.h
1 /** @file promise.h
2  *
3  *  @brief Promise class --- tracks future obligations for execution
4  *  related to weakly ordered writes.
5  */
6
7 #ifndef __PROMISE_H__
8 #define __PROMISE_H__
9
10 #include <inttypes.h>
11
12 class ModelAction;
13
14 class Promise {
15  public:
16  Promise(ModelAction *act, uint64_t value, modelclock_t expiration) :
17         value(value), expiration(expiration), read(act), numthreads(1)
18         { }
19         modelclock_t get_expiration() const {return expiration;}
20         ModelAction * get_action() const { return read; }
21         int increment_threads() { return ++numthreads; }
22         uint64_t get_value() const { return value; }
23
24  private:
25         const uint64_t value;
26         const modelclock_t expiration;
27         ModelAction * const read;
28         unsigned int numthreads;
29 };
30
31 #endif