diff options
author | 2006-01-01 18:53:25 +0000 | |
---|---|---|
committer | 2006-01-01 18:53:25 +0000 | |
commit | 30740e54ffa553a25a8c08633af7e77d47ac3f52 (patch) | |
tree | e8b71a1432514a9828981401a9c74c91f1089c8d | |
parent | Adjust for renamed VIA VT8233 PCI ID's. (diff) | |
download | wireguard-openbsd-30740e54ffa553a25a8c08633af7e77d47ac3f52.tar.xz wireguard-openbsd-30740e54ffa553a25a8c08633af7e77d47ac3f52.zip |
Nicer implementation of pthread_main_np(), which avoids the spinlock.
ok tedu@ marc@
-rw-r--r-- | lib/librthread/rthread_np.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/librthread/rthread_np.c b/lib/librthread/rthread_np.c index 894042e6a93..9fa5dba1537 100644 --- a/lib/librthread/rthread_np.c +++ b/lib/librthread/rthread_np.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_np.c,v 1.2 2005/12/30 20:35:11 otto Exp $ */ +/* $OpenBSD: rthread_np.c,v 1.3 2006/01/01 18:53:25 otto Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org> * Copyright (c) 2005 Otto Moerbeek <otto@openbsd.org> @@ -41,12 +41,7 @@ pthread_set_name_np(pthread_t thread, char *name) int pthread_main_np(void) { - pthread_t me = pthread_self(); - - if (me == NULL) - return (-1); - else - return (me == &_initial_thread ? 1 : 0); + return (!_threads_ready || getthrid() == _initial_thread.tid ? 1 : 0); } |