summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads.old/join.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-11-09 08:11:33 +0000
committerMike Frysinger <vapier@gentoo.org>2006-11-09 08:11:33 +0000
commit087d97a0a8349e5ddb23c7476b464a0eac85409a (patch)
tree189538f3cd8b173265d83133a02eccebed9bffeb /libpthread/linuxthreads.old/join.c
parentf0d13fdd5d5f11847ce6d5b148e167e7999e075e (diff)
backport from upstream:
2001-04-10 Ulrich Drepper <drepper@redhat.com> * join.c (pthread_exit): Move code to new function __pthread_do_exit which takes an extra parameter with the current frame pointer. Call new function with CURRENT_STACK_FRAME. (__pthread_do_exit): New function. Call __pthread_perform_cleanup with the new parameter. (pthread_join): Call __pthread_do_exit instead of pthread_exit. * cancel.c (__pthread_perform_cleanup): Takes extra parameter. Use this parameter as the initial value the cleanup handler records are compared against. No active cleanup handler record must have an address lower than the previous one and the initial record must be above (below on PA) the frame address passed in. (pthread_setcancelstate): Call __pthread_do_exit instead of pthread_exit. (pthread_setcanceltype): Likewise. (pthread_testcancel): Likewise. (_pthread_cleanup_pop_restore): Likewise. * condvar.c (pthread_cond_wait): Likewise. (pthread_cond_timedwait_relative): Likewise. * manager.c (pthread_start_thread): Likewise. * oldsemaphore.c (__old_sem_wait): Likewise. * pthread.c (pthread_handle_sigcancel): Likewise. * semaphore.c (__new_sem_wait): Likewise. (sem_timedwait): Likewise. * ptlongjmp.c (pthread_cleanup_upto): Also use current stack frame to limit the cleanup handlers which get run. * internals.h: Add prototype for __pthread_do_exit. Adjust prototype for __pthread_perform_cleanup.
Diffstat (limited to 'libpthread/linuxthreads.old/join.c')
-rw-r--r--libpthread/linuxthreads.old/join.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libpthread/linuxthreads.old/join.c b/libpthread/linuxthreads.old/join.c
index 6a8a9d982..f249a8114 100644
--- a/libpthread/linuxthreads.old/join.c
+++ b/libpthread/linuxthreads.old/join.c
@@ -27,6 +27,11 @@
void pthread_exit(void * retval)
{
+ __pthread_do_exit (retval, CURRENT_STACK_FRAME);
+}
+
+void __pthread_do_exit(void *retval, char *currentframe)
+{
pthread_descr self = thread_self();
pthread_descr joining;
struct pthread_request request;
@@ -36,7 +41,7 @@ void pthread_exit(void * retval)
contain cancellation points */
THREAD_SETMEM(self, p_canceled, 0);
/* Call cleanup functions and destroy the thread-specific data */
- __pthread_perform_cleanup();
+ __pthread_perform_cleanup(currentframe);
__pthread_destroy_specifics();
/* Store return value */
__pthread_lock(THREAD_GETMEM(self, p_lock), self);
@@ -150,7 +155,7 @@ int pthread_join(pthread_t thread_id, void ** thread_return)
if (already_canceled) {
__pthread_set_own_extricate_if(self, 0);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
PDEBUG("before suspend\n");
@@ -163,7 +168,7 @@ int pthread_join(pthread_t thread_id, void ** thread_return)
if (THREAD_GETMEM(self, p_woken_by_cancel)
&& THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) {
THREAD_SETMEM(self, p_woken_by_cancel, 0);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
__pthread_lock(&handle->h_lock, self);
}