summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-12-29 19:10:21 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-12-29 19:10:21 +0000
commit63e681454dba96f67c02da8dd918c8456da128ad (patch)
tree330dce327573faa7f9f1b5338f64d64002faf3d3
parent216d6ff52a791c08a17292a28f35b164f36dfb0d (diff)
implement pthread_main_np(); ok tedu@
-rw-r--r--lib/librthread/rthread.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/librthread/rthread.c b/lib/librthread/rthread.c
index c4e1e502d0d..8b6855bd65d 100644
--- a/lib/librthread/rthread.c
+++ b/lib/librthread/rthread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread.c,v 1.18 2005/12/23 03:27:06 tedu Exp $ */
+/* $OpenBSD: rthread.c,v 1.19 2005/12/29 19:10:20 otto Exp $ */
/*
* Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org>
* All Rights Reserved.
@@ -399,6 +399,18 @@ pthread_set_name_np(pthread_t thread, char *name)
strlcpy(thread->name, name, sizeof(thread->name));
}
+int
+pthread_main_np(void)
+{
+ pthread_t me = pthread_self();
+
+ if (me == NULL)
+ return (-1);
+ else
+ return (me == &initial_thread ? 1 : 0);
+}
+
+
/*
* compat debug stuff
*/