1 /* Test for notification mechanism in lio_listio.
2 Copyright (C) 2000-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
28 static pthread_barrier_t b
;
34 int e
= pthread_barrier_wait (&b
);
35 if (e
!= 0 && e
!= PTHREAD_BARRIER_SERIAL_THREAD
)
37 puts ("thread: barrier_wait failed");
44 do_test (int argc
, char *argv
[])
46 char name
[] = "/tmp/aio2.XXXXXX";
50 static const char buf
[] = "Hello World\n";
55 printf ("cannot open temp name: %m\n");
61 if (pthread_barrier_init (&b
, NULL
, 2) != 0)
63 puts ("barrier_init failed");
70 cb
.aio_lio_opcode
= LIO_WRITE
;
72 cb
.aio_buf
= (void *) buf
;
73 cb
.aio_nbytes
= sizeof (buf
) - 1;
75 cb
.aio_sigevent
.sigev_notify
= SIGEV_THREAD
;
76 cb
.aio_sigevent
.sigev_notify_function
= thrfct
;
77 cb
.aio_sigevent
.sigev_notify_attributes
= NULL
;
78 cb
.aio_sigevent
.sigev_value
.sival_ptr
= NULL
;
80 if (lio_listio (LIO_WAIT
, arr
, 1, NULL
) < 0)
84 puts ("no aio support in this configuration");
87 printf ("lio_listio failed: %m\n");
91 puts ("lio_listio returned");
93 int e
= pthread_barrier_wait (&b
);
94 if (e
!= 0 && e
!= PTHREAD_BARRIER_SERIAL_THREAD
)
96 puts ("barrier_wait failed");
105 #include "../test-skeleton.c"