]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* tst-aiod2.c: Adjust test for new semantics of lio_listio.
authorJakub Jelinek <jakub@redhat.com>
Thu, 7 Sep 2006 16:06:55 +0000 (16:06 +0000)
committerJakub Jelinek <jakub@redhat.com>
Thu, 7 Sep 2006 16:06:55 +0000 (16:06 +0000)
* tst-aiod3.c: The thread is now supposed to be created.

rtkaio/ChangeLog
rtkaio/tst-aiod2.c
rtkaio/tst-aiod3.c

index 41e329508034372ce902b17e38302547cdeb842d..8a03a3522554fc11612afda1470bf643597af6bb 100644 (file)
@@ -1,5 +1,8 @@
 2006-09-07  Jakub Jelinek  <jakub@redhat.com>
 
+       * tst-aiod2.c: Adjust test for new semantics of lio_listio.
+       * tst-aiod3.c: The thread is now supposed to be created.
+
        * Makefile: Use $(..) in place of ../.
        (tests): Add tst-aio{8,9,10}, tst-cpuclock{1,2}, tst-cputimer{1,2,3}
        and tst-clock2.
index a17e9e8ccfbb0ab03432280cd80df8a6a97afc5e..c516797c71045b74d8da99463ce4f868fff2bfd7 100644 (file)
 #include <errno.h>
 #include "tst-aiod.h"
 
-int flag;
+
+static pthread_barrier_t b;
 
 
 static void
 thrfct (sigval_t arg)
 {
-  flag = 1;
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("thread: barrier_wait failed");
+      exit (1);
+    }
 }
 
 
@@ -54,6 +60,12 @@ do_test (int argc, char *argv[])
 
   unlink (name);
 
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
   arr[0] = &cb;
 
   void *p;
@@ -99,9 +111,12 @@ do_test (int argc, char *argv[])
       return 1;
     }
 
-  if (flag != 0)
+  puts ("lio_listio returned");
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
     {
-      puts ("thread created, should not have happened");
+      puts ("barrier_wait failed");
       return 1;
     }
 
index 545a6d496c55f73d148fdbc68ed4bb0d4f52f391..aac04f377161a209f37fbe9c81a93c18ded9947f 100644 (file)
 #include <errno.h>
 #include "tst-aiod.h"
 
-int flag;
+
+static pthread_barrier_t b;
 
 
 static void
 thrfct (sigval_t arg)
 {
-  flag = 1;
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: barrier_wait failed");
+      exit (1);
+    }
 }
 
 
@@ -53,6 +59,12 @@ do_test (int argc, char *argv[])
 
   unlink (name);
 
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
   arr[0] = &cb;
 
   void *p;
@@ -104,9 +116,10 @@ do_test (int argc, char *argv[])
       return 1;
     }
 
-  if (flag != 0)
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
     {
-      puts ("thread created, should not have happened");
+      puts ("parent: barrier_wait failed");
       return 1;
     }