From: Brian Norris <banorris@uci.edu>
Date: Wed, 19 Dec 2012 06:48:21 +0000 (-0800)
Subject: test: don't relay on thrd_current() returning an int
X-Git-Tag: oopsla2013~403
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fda78132342c17dd25db22977211536d38f7e853;p=model-checker.git

test: don't relay on thrd_current() returning an int

The C11 spec doesn't require thrd_t to be a particular object
format/type. I will need to change this type, I think, so don't assume
it's an int.
---

diff --git a/test/deadlock.cc b/test/deadlock.cc
index 3b26bec..4810aa4 100644
--- a/test/deadlock.cc
+++ b/test/deadlock.cc
@@ -34,13 +34,13 @@ int user_main(int argc, char **argv)
 	x = new std::mutex();
 	y = new std::mutex();
 
-	printf("Thread %d: creating 2 threads\n", thrd_current());
+	printf("Main thread: creating 2 threads\n");
 	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());
+	printf("Main thread is finished\n");
 
 	return 0;
 }
diff --git a/test/double-relseq.c b/test/double-relseq.c
index 65c3f55..2ad1987 100644
--- a/test/double-relseq.c
+++ b/test/double-relseq.c
@@ -43,7 +43,7 @@ int user_main(int argc, char **argv)
 
 	atomic_init(&x, 0);
 
-	printf("Thread %d: creating 4 threads\n", thrd_current());
+	printf("Main thread: creating 4 threads\n");
 	thrd_create(&t1, (thrd_start_t)&a, NULL);
 	thrd_create(&t2, (thrd_start_t)&b, NULL);
 	thrd_create(&t3, (thrd_start_t)&b, NULL);
@@ -53,7 +53,7 @@ int user_main(int argc, char **argv)
 	thrd_join(t2);
 	thrd_join(t3);
 	thrd_join(t4);
-	printf("Thread %d is finished\n", thrd_current());
+	printf("Main thread is finished\n");
 
 	return 0;
 }
diff --git a/test/releaseseq.c b/test/releaseseq.c
index a63fa93..548f0a8 100644
--- a/test/releaseseq.c
+++ b/test/releaseseq.c
@@ -38,7 +38,7 @@ int user_main(int argc, char **argv)
 
 	atomic_init(&x, 0);
 
-	printf("Thread %d: creating 3 threads\n", thrd_current());
+	printf("Main thread: creating 3 threads\n");
 	thrd_create(&t1, (thrd_start_t)&a, NULL);
 	thrd_create(&t2, (thrd_start_t)&b, NULL);
 	thrd_create(&t3, (thrd_start_t)&c, NULL);
@@ -46,7 +46,7 @@ int user_main(int argc, char **argv)
 	thrd_join(t1);
 	thrd_join(t2);
 	thrd_join(t3);
-	printf("Thread %d is finished\n", thrd_current());
+	printf("Main thread is finished\n");
 
 	return 0;
 }
diff --git a/test/thinair.c b/test/thinair.c
index dcd7615..2f4f580 100644
--- a/test/thinair.c
+++ b/test/thinair.c
@@ -29,13 +29,13 @@ int user_main(int argc, char **argv)
 	atomic_init(&x, -1);
 	atomic_init(&y, 0);
 
-	printf("Thread %d: creating 2 threads\n", thrd_current());
+	printf("Main thread: creating 2 threads\n");
 	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());
+	printf("Main thread is finished\n");
 
 	return 0;
 }
diff --git a/test/uninit.cc b/test/uninit.cc
index 6b6f126..759a4fd 100644
--- a/test/uninit.cc
+++ b/test/uninit.cc
@@ -40,7 +40,7 @@ int user_main(int argc, char **argv)
 
 	std::atomic_init(&x, 0);
 
-	printf("Thread %d: creating 2 threads\n", thrd_current());
+	printf("Main thread: creating 2 threads\n");
 	thrd_create(&t1, (thrd_start_t)&a, NULL);
 	thrd_create(&t2, (thrd_start_t)&b, NULL);
 	thrd_create(&t3, (thrd_start_t)&c, NULL);
@@ -48,7 +48,7 @@ int user_main(int argc, char **argv)
 	thrd_join(t1);
 	thrd_join(t2);
 	thrd_join(t3);
-	printf("Thread %d is finished\n", thrd_current());
+	printf("Main thread is finished\n");
 
 	return 0;
 }
diff --git a/test/userprog.c b/test/userprog.c
index b75947e..02a83b4 100644
--- a/test/userprog.c
+++ b/test/userprog.c
@@ -28,13 +28,13 @@ int user_main(int argc, char **argv)
 	atomic_init(&x, 0);
 	atomic_init(&y, 0);
 
-	printf("Thread %d: creating 2 threads\n", thrd_current());
+	printf("Main thread: creating 2 threads\n");
 	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());
+	printf("Main thread is finished\n");
 
 	return 0;
 }