Just for kicks, since snapshotting is working properly. We might as well test
this.
#include <stdio.h>
+#include <stdlib.h>
#include "libthreads.h"
#include "libatomic.h"
void user_main()
{
thrd_t t1, t2;
- atomic_int obj;
+ atomic_int *obj;
- atomic_init(&obj, 0);
+ obj = malloc(sizeof(*obj));
+
+ atomic_init(obj, 0);
printf("Thread %d: creating 2 threads\n", thrd_current());
- thrd_create(&t1, (thrd_start_t)&a, &obj);
- thrd_create(&t2, (thrd_start_t)&a, &obj);
+ thrd_create(&t1, (thrd_start_t)&a, obj);
+ thrd_create(&t2, (thrd_start_t)&a, obj);
thrd_join(t1);
thrd_join(t2);
+ free(obj);
printf("Thread %d is finished\n", thrd_current());
}