about summary refs log tree commit diff
path: root/rt/tst-aio2.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-01-03 23:19:03 +0000
committerUlrich Drepper <drepper@redhat.com>2006-01-03 23:19:03 +0000
commit6d3aff23e2c64b64fe68fe88360185e17b3e936a (patch)
tree47755ce70732719bd318f1203454e287f8805d5d /rt/tst-aio2.c
parent1c50f6b6602a07f052249c6fe6dbab48357b68bd (diff)
downloadglibc-6d3aff23e2c64b64fe68fe88360185e17b3e936a.tar.gz
glibc-6d3aff23e2c64b64fe68fe88360185e17b3e936a.tar.xz
glibc-6d3aff23e2c64b64fe68fe88360185e17b3e936a.zip
lio_listio should emit an event for each individual request in
	addition to the global event.
	* sysdeps/pthread/lio_listio.c (lio_listio): Renamed to
	lio_listio_internal.  Remove mode parameter check.  Only set sigevent
	type ti SIGEV_NONE if LIO_NO_INDIVIDUAL_EVENT is set.
	(__lio_listio_21): New function.  Compatiblity version which sets
	LIO_NO_INDIVIDUAL_EVENT before calling lio_listio_internal.
	(__lio_listio_item_notify): New function.
	* sysdeps/pthread/lio_listio64.c: Define __lio_listio_21 and
	__lio_listio_item_notify macros.
	* sysdeps/pthread/Versions: New file.
	* rt/tst-aio2.c: Adjust test for new semantics of lio_listio.
	* include/aio.h: Define LIO_NO_INDIVIDUAL_EVENT.
	* Versions.def: Add GLIBC_2.4 for librt.

	* rt/Versions: Whitespace fix.
	* sysdeps/pthread/aio_misc.c: Likewise.
Diffstat (limited to 'rt/tst-aio2.c')
-rw-r--r--rt/tst-aio2.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/rt/tst-aio2.c b/rt/tst-aio2.c
index 1ff92ce93b..79076396a4 100644
--- a/rt/tst-aio2.c
+++ b/rt/tst-aio2.c
@@ -1,5 +1,5 @@
 /* Test for notification mechanism in lio_listio.
-   Copyright (C) 2000,02 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
 
@@ -25,13 +25,19 @@
 #include <unistd.h>
 #include <errno.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);
+    }
 }
 
 
@@ -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;
 
   cb.aio_fildes = fd;
@@ -77,9 +89,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;
     }