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 3b26bec65261544cae1e0c8f919629e2ef567983..4810aa4525d6cbf66c64f59d5e85b4dce9997f41 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 65c3f55d791df600afa617b61ef4468ef3a5df6b..2ad1987aebe197ec098e46ff9b1ea354e2f7f085 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 a63fa93620bb3601e6dbded7f8cff0e6fe92ebfb..548f0a822380ae19640cb30197d7ac6e1209fde4 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 dcd7615f20148db7ef30b6aa165b7a927bb23b57..2f4f58059f97107f0572e91e21f02b3437e455bc 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 6b6f126b1e6d5bf3783650875fc2077357c29d89..759a4fd8eaabf1f502bc22d9dddc66f8ec55e40b 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 b75947e226a284f940ded9975191f8c8a51c4fa2..02a83b4b2f2469f6af1f59c77038ed95c7878998 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;
 }