From 0d2962592522736fa08c74eb5f5e4847f574eaa6 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 26 Apr 2012 16:15:31 -0700 Subject: [PATCH] userprog: print atomic load/store values --- userprog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/userprog.c b/userprog.c index 4b106d8..bab9f98 100644 --- a/userprog.c +++ b/userprog.c @@ -6,15 +6,18 @@ static void a(atomic_int *obj) { int i; + int ret; for (i = 0; i < 10; i++) { printf("Thread %d, loop %d\n", thrd_current(), i); switch (i % 4) { case 1: - atomic_load(obj); + ret = atomic_load(obj); + printf("Read value: %d\n", ret); break; case 3: atomic_store(obj, i); + printf("Write value: %d\n", i); break; } } -- 2.34.1