about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-09-07 16:06:55 +0000
committerJakub Jelinek <jakub@redhat.com>2006-09-07 16:06:55 +0000
commitb2adc86677d215d3d8071393d2a69357dd844821 (patch)
treeff42a4bcece19ef14c90ff3ffa4b102b80b455ed
parenteaa2ea12a27561393da77bcf435dad34d84d3e14 (diff)
downloadglibc-b2adc86677d215d3d8071393d2a69357dd844821.tar.gz
glibc-b2adc86677d215d3d8071393d2a69357dd844821.tar.xz
glibc-b2adc86677d215d3d8071393d2a69357dd844821.zip
* tst-aiod2.c: Adjust test for new semantics of lio_listio.
	* tst-aiod3.c: The thread is now supposed to be created.
-rw-r--r--rtkaio/ChangeLog3
-rw-r--r--rtkaio/tst-aiod2.c23
-rw-r--r--rtkaio/tst-aiod3.c21
3 files changed, 39 insertions, 8 deletions
diff --git a/rtkaio/ChangeLog b/rtkaio/ChangeLog
index 41e3295080..8a03a35225 100644
--- a/rtkaio/ChangeLog
+++ b/rtkaio/ChangeLog
@@ -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.
diff --git a/rtkaio/tst-aiod2.c b/rtkaio/tst-aiod2.c
index a17e9e8ccf..c516797c71 100644
--- a/rtkaio/tst-aiod2.c
+++ b/rtkaio/tst-aiod2.c
@@ -26,13 +26,19 @@
 #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;
     }
 
diff --git a/rtkaio/tst-aiod3.c b/rtkaio/tst-aiod3.c
index 545a6d496c..aac04f3771 100644
--- a/rtkaio/tst-aiod3.c
+++ b/rtkaio/tst-aiod3.c
@@ -25,13 +25,19 @@
 #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;
     }