model: don't use global 'model' unnecessarily
[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) :
17                 value(value), read(act), numthreads(1)
18         { }
19         ModelAction * get_action() const { return read; }
20         int increment_threads() { return ++numthreads; }
21         uint64_t get_value() const { return value; }
22
23  private:
24         const uint64_t value;
25         ModelAction * const read;
26         unsigned int numthreads;
27 };
28
29 #endif