2002-12-11 Ulrich Drepper <drepper@redhat.com>
+ * Makefile (tests): Add tst-cleanup1.
+ * tst-cleanup1.c: New file.
+ * cancellation.c (__cleanup_thread): Removed.
+ (__do_cancel): Remove call to __cleanup_thread.
+ * pthreadP.h: Remove __cleanup_thread prorotype.
+
* sysdeps/pthread/bits/libc-lock.h (__libc_cleanup_region_start):
Remember function and argument even if cancellation handler
function is not available.
tst-fork1 tst-fork2 tst-fork3 \
tst-atfork1 \
tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel4 \
+ tst-cleanup1 \
tst-flock1 tst-flock2 \
tst-signal1 tst-signal2 tst-signal3 \
tst-exec1 tst-exec2 tst-exec3 \
{
struct pthread *self = THREAD_SELF;
- /* Cleanup the thread-local storage. */
- __cleanup_thread (self, currentframe);
-
/* Throw an exception. */
// XXX TBI
}
-void
-__cleanup_thread (struct pthread *self, char *currentframe)
-{
- struct _pthread_cleanup_buffer *cleanups;
-
- /* Call all registered cleanup handlers. */
- cleanups = THREAD_GETMEM (self, cleanup);
- if (__builtin_expect (cleanups != NULL, 0))
- {
- struct _pthread_cleanup_buffer *last;
-
- while (FRAME_LEFT (currentframe, cleanups))
- {
- last = cleanups;
- cleanups = cleanups->__prev;
-
- if (cleanups == NULL || FRAME_LEFT (last, cleanups))
- {
- cleanups = NULL;
- break;
- }
- }
-
- while (cleanups != NULL)
- {
- /* Call the registered cleanup function. */
- cleanups->__routine (cleanups->__arg);
-
- last = cleanups;
- cleanups = cleanups->__prev;
-
- if (FRAME_LEFT (last, cleanups))
- break;
- }
- }
-}
-
-
/* The next two functions are similar to pthread_setcanceltype() but
more specialized for the use in the cancelable functions like write().
They do not need to check parameters etc. */
/* Function performing the cancellation. */
extern void __do_cancel (char *currentframe)
__attribute ((visibility ("hidden"), noreturn, regparm (1)));
-extern void __cleanup_thread (struct pthread *self, char *currentframe)
- __attribute ((visibility ("hidden"), regparm (2)));
/* Test whether stackframe is still active. */