aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/pthread/lio_listio.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-01-06 03:08:04 +0000
committerUlrich Drepper <drepper@redhat.com>2006-01-06 03:08:04 +0000
commit679d83bac2f4bed0e398122fdf3e05ce261e16b7 (patch)
tree9b40b6068a156c300bcb260453a97ae1168ae6db /sysdeps/pthread/lio_listio.c
parent17041e4ff09d3a9308c15bdfc2e63e629d9b364b (diff)
downloadglibc-679d83bac2f4bed0e398122fdf3e05ce261e16b7.tar
glibc-679d83bac2f4bed0e398122fdf3e05ce261e16b7.tar.gz
glibc-679d83bac2f4bed0e398122fdf3e05ce261e16b7.tar.bz2
glibc-679d83bac2f4bed0e398122fdf3e05ce261e16b7.zip
* sysdeps/pthread/aio_misc.h [!DONT_USE_BOOTSTRAP_MAP]
(struct waitlist): Don't add cond. * sysdeps/pthread/aio_notify.c [!DONT_USE_BOOTSTRAP_MAP] (__aio_notify): Use AIO_MISC_NOTIFY instead of pthread_cond_signal. * sysdeps/pthread/aio_suspend.c [!DONT_USE_BOOTSTRAP_MAP]: Don't use condvar, use AIO_MISC_WAIT. * sysdeps/pthread/lio_listio.c: Likewise. * rt/Makefile (tests): Add aio_suspend. * rt/tst-aio9.c: New file.
Diffstat (limited to 'sysdeps/pthread/lio_listio.c')
-rw-r--r--sysdeps/pthread/lio_listio.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sysdeps/pthread/lio_listio.c b/sysdeps/pthread/lio_listio.c
index d6ad5a2b48..39187f3025 100644
--- a/sysdeps/pthread/lio_listio.c
+++ b/sysdeps/pthread/lio_listio.c
@@ -122,9 +122,11 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent,
}
else if (LIO_MODE (mode) == LIO_WAIT)
{
+#ifndef DONT_NEED_AIO_MISC_COND
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
- struct waitlist waitlist[nent];
int oldstate;
+#endif
+ struct waitlist waitlist[nent];
total = 0;
for (cnt = 0; cnt < nent; ++cnt)
@@ -133,7 +135,9 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent,
if (requests[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
{
+#ifndef DONT_NEED_AIO_MISC_COND
waitlist[cnt].cond = &cond;
+#endif
waitlist[cnt].result = &result;
waitlist[cnt].next = requests[cnt]->waiting;
waitlist[cnt].counterp = &total;
@@ -146,6 +150,9 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent,
}
}
+#ifdef DONT_NEED_AIO_MISC_COND
+ AIO_MISC_WAIT (result, total, NULL, 0);
+#else
/* Since `pthread_cond_wait'/`pthread_cond_timedwait' are cancellation
points we must be careful. We added entries to the waiting lists
which we must remove. So defer cancellation for now. */
@@ -161,6 +168,7 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent,
if (pthread_cond_destroy (&cond) != 0)
/* This must never happen. */
abort ();
+#endif
/* If any of the I/O requests failed, return -1 and set errno. */
if (result != 0)
@@ -193,7 +201,9 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent,
if (requests[cnt] != NULL
&& list[cnt]->aio_lio_opcode != LIO_NOP)
{
+#ifndef DONT_NEED_AIO_MISC_COND
waitlist->list[cnt].cond = NULL;
+#endif
waitlist->list[cnt].result = NULL;
waitlist->list[cnt].next = requests[cnt]->waiting;
waitlist->list[cnt].counterp = &waitlist->counter;