From 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 12 Jul 2007 18:26:36 +0000 Subject: 2.5-18.1 --- rt/tst-aio2.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'rt/tst-aio2.c') 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 , 2000. @@ -25,13 +25,19 @@ #include #include -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; } -- cgit 1.4.1