test: don't relay on thrd_current() returning an int
authorBrian Norris <banorris@uci.edu>
Wed, 19 Dec 2012 06:48:21 +0000 (22:48 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 19 Dec 2012 06:49:24 +0000 (22:49 -0800)
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.

test/deadlock.cc
test/double-relseq.c
test/releaseseq.c
test/thinair.c
test/uninit.cc
test/userprog.c

index 3b26bec..4810aa4 100644 (file)
@@ -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;
 }
index 65c3f55..2ad1987 100644 (file)
@@ -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;
 }
index a63fa93..548f0a8 100644 (file)
@@ -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;
 }
index dcd7615..2f4f580 100644 (file)
@@ -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;
 }
index 6b6f126..759a4fd 100644 (file)
@@ -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;
 }
index b75947e..02a83b4 100644 (file)
@@ -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;
 }