typo
[model-checker-benchmarks.git] / seqlock / seqlock.h
1 #ifndef _SEQLOCK_H
2 #define _SEQLOCK_H
3
4 #include <stdatomic.h>
5
6 class seqlock {
7         public:
8         // Sequence for reader consistency check
9         atomic_int _seq;
10         // It needs to be atomic to avoid data races
11         atomic_int _data1;
12         atomic_int _data2;
13
14         seqlock();
15
16         void read(int *data1, int *data2);
17
18         void write(int data1, int data2);
19 };
20
21 /** C Interface */
22 void write(seqlock *lock, int data1, int data2);
23 void read(seqlock *lock, int *data1, int *data2);
24
25 #endif