model->switch_to_master(new ModelAction(ATOMIC_READ, order, obj, VALUE_NONE));
return obj->value;
}
+
+void atomic_init(struct atomic_object *obj, int value)
+{
+ obj->value = value;
+}
int atomic_load_explicit(struct atomic_object *obj, memory_order order);
#define atomic_load(A) atomic_load_explicit((A), memory_order_seq_cst)
+ void atomic_init(struct atomic_object *obj, int value);
+
#ifdef __cplusplus
}
#endif
thrd_t t1, t2;
atomic_int obj;
+ atomic_init(&obj, 0);
+
printf("Creating 2 threads\n");
thrd_create(&t1, (thrd_start_t)&a, &obj);
thrd_create(&t2, (thrd_start_t)&a, &obj);