projects
/
model-checker-benchmarks.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
deque: add MODEL_ASSERT(), fixup #include's
[model-checker-benchmarks.git]
/
chase-lev-deque
/
main.c
1
#include <stdlib.h>
2
#include <assert.h>
3
#include <stdio.h>
4
#include <threads.h>
5
#include <stdatomic.h>
6
#include <stdio.h>
7
8
#include "model-assert.h"
9
10
#include "deque.h"
11
12
Deque *q;
13
int a;
14
int b;
15
16
static void task(void * param) {
17
do {
18
a=steal(q);
19
} while(a==EMPTY);
20
}
21
22
int user_main(int argc, char **argv)
23
{
24
thrd_t t;
25
q=create();
26
thrd_create(&t, task, 0);
27
push(q, 1);
28
push(q, 2);
29
b=take(q);
30
thrd_join(t);
31
32
printf("a=%d b=%d\n",a,b);
33
MODEL_ASSERT(a + b == 3);
34
35
return 0;
36
}