summaryrefslogtreecommitdiff
path: root/lib/libc_r/uthread/uthread_clean.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc_r/uthread/uthread_clean.c')
-rw-r--r--lib/libc_r/uthread/uthread_clean.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libc_r/uthread/uthread_clean.c b/lib/libc_r/uthread/uthread_clean.c
index 0fc9a272f7f..ed6df7d70b6 100644
--- a/lib/libc_r/uthread/uthread_clean.c
+++ b/lib/libc_r/uthread/uthread_clean.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_clean.c,v 1.3 1999/11/25 07:01:32 d Exp $ */
+/* $OpenBSD: uthread_clean.c,v 1.4 2001/08/21 19:24:53 fgsch Exp $ */
/*
* Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
@@ -42,24 +42,26 @@
void
pthread_cleanup_push(void (*routine) (void *), void *routine_arg)
{
+ struct pthread *curthread = _get_curthread();
struct pthread_cleanup *new;
if ((new = (struct pthread_cleanup *) malloc(sizeof(struct pthread_cleanup))) != NULL) {
new->routine = routine;
new->routine_arg = routine_arg;
- new->next = _thread_run->cleanup;
+ new->next = curthread->cleanup;
- _thread_run->cleanup = new;
+ curthread->cleanup = new;
}
}
void
pthread_cleanup_pop(int execute)
{
+ struct pthread *curthread = _get_curthread();
struct pthread_cleanup *old;
- if ((old = _thread_run->cleanup) != NULL) {
- _thread_run->cleanup = old->next;
+ if ((old = curthread->cleanup) != NULL) {
+ curthread->cleanup = old->next;
if (execute) {
old->routine(old->routine_arg);
}