userprog: move to 'test/' directory
authorBrian Norris <banorris@uci.edu>
Thu, 2 Aug 2012 23:27:02 +0000 (16:27 -0700)
committerBrian Norris <banorris@uci.edu>
Thu, 2 Aug 2012 23:40:02 +0000 (16:40 -0700)
test/userprog.c [new file with mode: 0644]
userprog.c [deleted file]

diff --git a/test/userprog.c b/test/userprog.c
new file mode 100644 (file)
index 0000000..645dc30
--- /dev/null
@@ -0,0 +1,38 @@
+#include <stdio.h>
+
+#include "libthreads.h"
+#include "librace.h"
+#include "stdatomic.h"
+
+atomic_int x;
+atomic_int y;
+
+static void a(void *obj)
+{
+       int r1=atomic_load_explicit(&y, memory_order_relaxed);
+       atomic_store_explicit(&x, r1, memory_order_relaxed);
+       printf("r1=%u\n",r1);
+}
+
+static void b(void *obj)
+{
+       int r2=atomic_load_explicit(&x, memory_order_relaxed);
+       atomic_store_explicit(&y, 42, memory_order_relaxed);
+       printf("r2=%u\n",r2);
+}
+
+void user_main()
+{
+       thrd_t t1, t2;
+
+       atomic_init(&x, 0);
+       atomic_init(&y, 0);
+
+       printf("Thread %d: creating 2 threads\n", thrd_current());
+       thrd_create(&t1, (thrd_start_t)&a, NULL);
+       thrd_create(&t2, (thrd_start_t)&b, NULL);
+
+       thrd_join(t1);
+       thrd_join(t2);
+       printf("Thread %d is finished\n", thrd_current());
+}
diff --git a/userprog.c b/userprog.c
deleted file mode 100644 (file)
index 645dc30..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <stdio.h>
-
-#include "libthreads.h"
-#include "librace.h"
-#include "stdatomic.h"
-
-atomic_int x;
-atomic_int y;
-
-static void a(void *obj)
-{
-       int r1=atomic_load_explicit(&y, memory_order_relaxed);
-       atomic_store_explicit(&x, r1, memory_order_relaxed);
-       printf("r1=%u\n",r1);
-}
-
-static void b(void *obj)
-{
-       int r2=atomic_load_explicit(&x, memory_order_relaxed);
-       atomic_store_explicit(&y, 42, memory_order_relaxed);
-       printf("r2=%u\n",r2);
-}
-
-void user_main()
-{
-       thrd_t t1, t2;
-
-       atomic_init(&x, 0);
-       atomic_init(&y, 0);
-
-       printf("Thread %d: creating 2 threads\n", thrd_current());
-       thrd_create(&t1, (thrd_start_t)&a, NULL);
-       thrd_create(&t2, (thrd_start_t)&b, NULL);
-
-       thrd_join(t1);
-       thrd_join(t2);
-       printf("Thread %d is finished\n", thrd_current());
-}