summaryrefslogtreecommitdiffstats
path: root/lib/librthread/rthread.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2005-12-14 04:01:44 +0000
committertedu <tedu@openbsd.org>2005-12-14 04:01:44 +0000
commit4524a5934ce9eda10e58c7d996c22c47cd5b20aa (patch)
tree87bca3f249559beb80dc7064ab2062ff08791f93 /lib/librthread/rthread.c
parentAdjust debug printing levels to something more sane. (diff)
downloadwireguard-openbsd-4524a5934ce9eda10e58c7d996c22c47cd5b20aa.tar.xz
wireguard-openbsd-4524a5934ce9eda10e58c7d996c22c47cd5b20aa.zip
change keys to use table instead of list, makes a sane destructor implementation
possible
Diffstat (limited to 'lib/librthread/rthread.c')
-rw-r--r--lib/librthread/rthread.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/librthread/rthread.c b/lib/librthread/rthread.c
index e60ef5f51a1..db6a492b2be 100644
--- a/lib/librthread/rthread.c
+++ b/lib/librthread/rthread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread.c,v 1.3 2005/12/13 05:56:55 tedu Exp $ */
+/* $OpenBSD: rthread.c,v 1.4 2005/12/14 04:01:44 tedu Exp $ */
/*
* Copyright (c) 2004 Ted Unangst <tedu@openbsd.org>
* All Rights Reserved.
@@ -96,6 +96,8 @@ thread_init(void)
pthread_t thread;
extern int __isthreaded;
+ printf("rthread init\n");
+
__isthreaded = 1;
thread = malloc(sizeof(*thread));
@@ -117,7 +119,6 @@ alloc_stack(size_t len)
return (stack);
}
-
/*
* real pthread functions
*/
@@ -143,7 +144,9 @@ pthread_exit(void *retval)
thread->retval = retval;
thread->flags |= THREAD_DONE;
+
_sem_post(&thread->donesem);
+ rthread_tls_destructors(thread);
#if 0
if (thread->flags & THREAD_DETACHED)
free(thread);