#include <stdio.h>
#include <threads.h>
#include <stdatomic.h>
+#include <stdio.h>
+
+#include "model-assert.h"
#include "deque.h"
int b;
static void task(void * param) {
- a=steal(q);
+ do {
+ a=steal(q);
+ } while(a==EMPTY);
}
int user_main(int argc, char **argv)
thrd_create(&t, task, 0);
push(q, 1);
push(q, 2);
- do {
- b=take(q);
- } while(b==EMPTY);
+ b=take(q);
thrd_join(t);
- if (a+b!=3)
- printf("a=%d b=%d\n",a,b);
+
+ printf("a=%d b=%d\n",a,b);
+ MODEL_ASSERT(a + b == 3);
+
return 0;
}