From 3a9eb648bb714d69623bf0344ae3e6c69b6237f1 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 15 Aug 1999 18:14:36 +0000 Subject: Update. 1999-08-15 Ulrich Drepper * sysdeps/unix/sysv/linux/aio_sigqueue.c: Take extra parameter and initialize si_pid from it. * sysdeps/generic/aio_sigqueue.c (__aio_sigqueue): Take extra parameter. * rt/aio_misc.c (__aio_enqueue_request): Initialize caller_pid. * rt/aio_misc.h (struct waitlist): Add caller_pid element. (struct requestlist): Likewise. Adjust prototypes of __aio_notify_only and __aio_sigqueue. * rt/notify.c (__aio_notify_only): Take extra parameter. Pass it to __aio_sigqueue. (__aio_notify): Pass caller PID to __aio_notify_only. * rt/aio_suspend.c: Initialize caller_pid. * rt/lio_listio.c: Likewise. * rt/lio_listio64.c: Likewise. * rt/lio_listio.c: If nothing has to be done free mutex before signalling. * rt/lio_listio64.c: Likewise. --- rt/lio_listio.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'rt/lio_listio.c') diff --git a/rt/lio_listio.c b/rt/lio_listio.c index 03c3bf2f6b..13d1b79a58 100644 --- a/rt/lio_listio.c +++ b/rt/lio_listio.c @@ -1,5 +1,5 @@ /* Enqueue and list of read or write requests. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -21,6 +21,7 @@ #include #include #include +#include #include "aio_misc.h" @@ -77,8 +78,17 @@ lio_listio (mode, list, nent, sig) { /* We don't have anything to do except signalling if we work asynchronously. */ + + /* Release the mutex. We do this before raising a signal since the + signal handler might do a `siglongjmp' and then the mutex is + locked forever. */ + pthread_mutex_unlock (&__aio_requests_mutex); + if (mode == LIO_NOWAIT) - __aio_notify_only (sig); + __aio_notify_only (sig, + sig->sigev_notify == SIGEV_SIGNAL ? getpid () : 0); + + return result; } else if (mode == LIO_WAIT) { @@ -95,6 +105,7 @@ lio_listio (mode, list, nent, sig) waitlist[cnt].next = requests[cnt]->waiting; waitlist[cnt].counterp = &total; waitlist[cnt].sigevp = NULL; + waitlist[cnt].caller_pid = 0; /* Not needed. */ requests[cnt]->waiting = &waitlist[cnt]; ++total; } @@ -130,6 +141,7 @@ lio_listio (mode, list, nent, sig) } else { + pid_t caller_pid = sig->sigev_notify == SIGEV_SIGNAL ? getpid () : 0; total = 0; for (cnt = 0; cnt < nent; ++cnt) @@ -140,6 +152,7 @@ lio_listio (mode, list, nent, sig) waitlist->list[cnt].next = requests[cnt]->waiting; waitlist->list[cnt].counterp = &waitlist->counter; waitlist->list[cnt].sigevp = &waitlist->sigev; + waitlist->list[cnt].caller_pid = caller_pid; requests[cnt]->waiting = &waitlist->list[cnt]; ++total; } -- cgit v1.2.1