summaryrefslogtreecommitdiff
path: root/lib/librthread/rthread.c
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2011-12-28 04:59:32 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2011-12-28 04:59:32 +0000
commit4528b904e1ee4b89589458975f63011190445d71 (patch)
treeec1d645040fda12521e87d20d7c18f4247de419f /lib/librthread/rthread.c
parentdda8e22c6d4df28744221783cf2bc8d0a810d100 (diff)
pthread_self() may be much cheaper and never more expensive than getthrid()
so prefer it for identifying the current thread
Diffstat (limited to 'lib/librthread/rthread.c')
-rw-r--r--lib/librthread/rthread.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/librthread/rthread.c b/lib/librthread/rthread.c
index 313dddcd513..b4016f656d5 100644
--- a/lib/librthread/rthread.c
+++ b/lib/librthread/rthread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread.c,v 1.48 2011/12/27 17:33:21 guenther Exp $ */
+/* $OpenBSD: rthread.c,v 1.49 2011/12/28 04:59:31 guenther Exp $ */
/*
* Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org>
* All Rights Reserved.
@@ -277,10 +277,11 @@ int
pthread_join(pthread_t thread, void **retval)
{
int e;
+ pthread_t self = pthread_self();
if (thread == NULL)
e = EINVAL;
- else if (thread->tid == getthrid())
+ else if (thread == self)
e = EDEADLK;
else if (thread->flags & THREAD_DETACHED)
e = EINVAL;