diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
commit | a334319f6530564d22e775935d9c91663623a1b4 (patch) | |
tree | b5877475619e4c938e98757d518bb1e9cbead751 /sysdeps/pthread/aio_suspend.c | |
parent | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff) | |
download | glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.xz glibc-a334319f6530564d22e775935d9c91663623a1b4.zip |
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'sysdeps/pthread/aio_suspend.c')
-rw-r--r-- | sysdeps/pthread/aio_suspend.c | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/sysdeps/pthread/aio_suspend.c b/sysdeps/pthread/aio_suspend.c index b85b16d10e..207dad964e 100644 --- a/sysdeps/pthread/aio_suspend.c +++ b/sysdeps/pthread/aio_suspend.c @@ -1,5 +1,5 @@ /* Suspend until termination of a requests. - Copyright (C) 1997-2000,2002,2003,2005,2006 Free Software Foundation, Inc. + Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -36,7 +36,7 @@ #include <sys/time.h> #include <bits/libc-lock.h> -#include <aio_misc.h> +#include "aio_misc.h" struct clparam @@ -44,9 +44,7 @@ struct clparam const struct aiocb *const *list; struct waitlist *waitlist; struct requestlist **requestlist; -#ifndef DONT_NEED_AIO_MISC_COND pthread_cond_t *cond; -#endif int nent; }; @@ -54,12 +52,6 @@ struct clparam static void cleanup (void *arg) { -#ifdef DONT_NEED_AIO_MISC_COND - /* Acquire the mutex. If pthread_cond_*wait is used this would - happen implicitly. */ - pthread_mutex_lock (&__aio_requests_mutex); -#endif - const struct clparam *param = (const struct clparam *) arg; /* Now remove the entry in the waiting list for all requests @@ -83,10 +75,8 @@ cleanup (void *arg) *listp = (*listp)->next; } -#ifndef DONT_NEED_AIO_MISC_COND /* Release the conditional variable. */ (void) pthread_cond_destroy (param->cond); -#endif /* Release the mutex. */ pthread_mutex_unlock (&__aio_requests_mutex); @@ -99,21 +89,13 @@ aio_suspend (list, nent, timeout) int nent; const struct timespec *timeout; { - if (__builtin_expect (nent < 0, 0)) - { - __set_errno (EINVAL); - return -1; - } - struct waitlist waitlist[nent]; struct requestlist *requestlist[nent]; -#ifndef DONT_NEED_AIO_MISC_COND pthread_cond_t cond = PTHREAD_COND_INITIALIZER; -#endif int cnt; bool any = false; int result = 0; - int cntr = 1; + int dummy; /* Request the mutex. */ pthread_mutex_lock (&__aio_requests_mutex); @@ -129,12 +111,9 @@ aio_suspend (list, nent, timeout) if (requestlist[cnt] != NULL) { -#ifndef DONT_NEED_AIO_MISC_COND waitlist[cnt].cond = &cond; -#endif - waitlist[cnt].result = NULL; waitlist[cnt].next = requestlist[cnt]->waiting; - waitlist[cnt].counterp = &cntr; + waitlist[cnt].counterp = &dummy; waitlist[cnt].sigevp = NULL; #ifdef BROKEN_THREAD_SIGNALS waitlist[cnt].caller_pid = 0; /* Not needed. */ @@ -160,17 +139,12 @@ aio_suspend (list, nent, timeout) .list = list, .waitlist = waitlist, .requestlist = requestlist, -#ifndef DONT_NEED_AIO_MISC_COND .cond = &cond, -#endif .nent = nent }; pthread_cleanup_push (cleanup, &clparam); -#ifdef DONT_NEED_AIO_MISC_COND - AIO_MISC_WAIT (result, cntr, timeout, 1); -#else if (timeout == NULL) result = pthread_cond_wait (&cond, &__aio_requests_mutex); else @@ -192,7 +166,6 @@ aio_suspend (list, nent, timeout) result = pthread_cond_timedwait (&cond, &__aio_requests_mutex, &abstime); } -#endif pthread_cleanup_pop (0); } @@ -216,23 +189,19 @@ aio_suspend (list, nent, timeout) *listp = (*listp)->next; } -#ifndef DONT_NEED_AIO_MISC_COND /* Release the conditional variable. */ if (__builtin_expect (pthread_cond_destroy (&cond) != 0, 0)) /* This must never happen. */ abort (); -#endif if (result != 0) { -#ifndef DONT_NEED_AIO_MISC_COND - /* An error occurred. Possibly it's ETIMEDOUT. We have to translate + /* An error occurred. Possibly it's EINTR. We have to translate the timeout error report of `pthread_cond_timedwait' to the form expected from `aio_suspend'. */ if (result == ETIMEDOUT) __set_errno (EAGAIN); else -#endif __set_errno (result); result = -1; |