This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: exception handling predicament


From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 19 Aug 2011 17:11:55 +0200

> If aio_suspend.c is the only spot where a cancellation point happens in the
> same function as corresponding cleanups, then IMHO the best fix is just to
> make sure it is in a different function (with noinline attribute, not marked
> as nothrow), which will be the cancellation point.

I've verified the following fixes the test case failures reliably.

Ok to commit?

2011-08-20  David S. Miller  <davem@firepit.lan>

	* sysdeps/pthread/aio_suspend.c (do_aio_misc_wait): New function.
	(aio_suspend): Call it to force an exception region around the
	AIO_MISC_WAIT() invocation.

diff --git a/sysdeps/pthread/aio_suspend.c b/sysdeps/pthread/aio_suspend.c
index b85b16d..99f3a80 100644
--- a/sysdeps/pthread/aio_suspend.c
+++ b/sysdeps/pthread/aio_suspend.c
@@ -92,6 +92,18 @@ cleanup (void *arg)
   pthread_mutex_unlock (&__aio_requests_mutex);
 }
 
+#ifdef DONT_NEED_AIO_MISC_COND
+static int
+__attribute__ ((noinline))
+do_aio_misc_wait(int *cntr, const struct timespec *timeout)
+{
+	int result = 0;
+
+	AIO_MISC_WAIT(result, *cntr, timeout, 1);
+
+	return result;
+}
+#endif
 
 int
 aio_suspend (list, nent, timeout)
@@ -169,7 +181,7 @@ aio_suspend (list, nent, timeout)
       pthread_cleanup_push (cleanup, &clparam);
 
 #ifdef DONT_NEED_AIO_MISC_COND
-      AIO_MISC_WAIT (result, cntr, timeout, 1);
+      result = do_aio_misc_wait(&cntr, timeout);
 #else
       if (timeout == NULL)
 	result = pthread_cond_wait (&cond, &__aio_requests_mutex);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]