diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-01-01 18:53:26 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-01-01 18:53:26 +0000 |
commit | f2c2ad363c500811edaf5cd824cdf234ee6870f1 (patch) | |
tree | df0f32c4ba362391f779a056096d1f4a94aa8ee2 | |
parent | 96cb4abe859d67d7a99a23ac701a3f8bca3e1100 (diff) |
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); } |