From 96598fb588eae2fa5050ab83cb3e362f2d6cbbec Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Tue, 15 May 2012 10:19:08 -0700 Subject: [PATCH] userprog: tweak test program to use simple loads/stores --- userprog.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/userprog.c b/userprog.c index ba0c867f..402cb0d2 100644 --- a/userprog.c +++ b/userprog.c @@ -2,22 +2,26 @@ #include "libthreads.h" #include "libatomic.h" +#include "librace.h" static void a(atomic_int *obj) { int i; int ret; - for (i = 0; i < 10; i++) { + store_32(&i, 10); + printf("load 32 yields: %d\n", load_32(&i)); + + for (i = 0; i < 2; i++) { printf("Thread %d, loop %d\n", thrd_current(), i); switch (i % 4) { case 1: ret = atomic_load(obj); printf("Read value: %d\n", ret); break; - case 3: - atomic_store(obj, i); - printf("Write value: %d\n", i); + case 0: + atomic_store(obj, i + 1); + printf("Write value: %d\n", i + 1); break; } } -- 2.34.1