summaryrefslogtreecommitdiffstats
path: root/lib/librthread/rthread_np.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2011-12-28 04:59:31 +0000
committerguenther <guenther@openbsd.org>2011-12-28 04:59:31 +0000
commit1bbb51b7c7b26224d8ceef9e36ec869b4343a38f (patch)
tree7d68c44d9d21a8e168f82264b923916c422d221c /lib/librthread/rthread_np.c
parentThese utilities were already part of 1BSD, and some authors are known. (diff)
downloadwireguard-openbsd-1bbb51b7c7b26224d8ceef9e36ec869b4343a38f.tar.xz
wireguard-openbsd-1bbb51b7c7b26224d8ceef9e36ec869b4343a38f.zip
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_np.c')
-rw-r--r--lib/librthread/rthread_np.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/librthread/rthread_np.c b/lib/librthread/rthread_np.c
index cb36095a917..69acbd458e6 100644
--- a/lib/librthread/rthread_np.c
+++ b/lib/librthread/rthread_np.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_np.c,v 1.5 2007/07/08 01:53:46 kurt Exp $ */
+/* $OpenBSD: rthread_np.c,v 1.6 2011/12/28 04:59:31 guenther Exp $ */
/*
* Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org>
* Copyright (c) 2005 Otto Moerbeek <otto@openbsd.org>
@@ -44,7 +44,7 @@ pthread_set_name_np(pthread_t thread, const char *name)
int
pthread_main_np(void)
{
- return (!_threads_ready || getthrid() == _initial_thread.tid ? 1 : 0);
+ return (!_threads_ready || pthread_self() == &_initial_thread ? 1 : 0);
}