summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_getprio.c
diff options
context:
space:
mode:
authorJohn Birrell <jb@FreeBSD.org>1998-04-29 09:59:34 +0000
committerJohn Birrell <jb@FreeBSD.org>1998-04-29 09:59:34 +0000
commit4a027d50c7f3f30178a89b3159ba9e4b44f06885 (patch)
treeb7a4ea836e97e11d436f9a6657ea6a9ec8036c33 /lib/libpthread/thread/thr_getprio.c
parentccf47cfcedf9f3db1780bc3b52ca0adb4480d3f6 (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_getprio.c')
-rw-r--r--lib/libpthread/thread/thr_getprio.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/lib/libpthread/thread/thr_getprio.c b/lib/libpthread/thread/thr_getprio.c
index 85bd2616b735..708b8f1adf75 100644
--- a/lib/libpthread/thread/thr_getprio.c
+++ b/lib/libpthread/thread/thr_getprio.c
@@ -38,36 +38,19 @@
int
pthread_getprio(pthread_t pthread)
{
- int rval = 0;
- int status;
- pthread_t pthread_p;
+ int ret;
- /* Block signals: */
- _thread_kern_sig_block(&status);
-
- /* Point to the first thread in the list: */
- pthread_p = _thread_link_list;
-
- /* Enter a loop to search for the thread: */
- while (pthread_p != NULL && pthread_p != pthread) {
- /* Point to the next thread: */
- pthread_p = pthread_p->nxt;
- }
-
- /* Check if the thread pointer is NULL: */
- if (pthread == NULL || pthread_p == NULL) {
- /* Return an invalid argument error: */
- errno = EINVAL;
- rval = -1;
- } else {
+ /* Find the thread in the list of active threads: */
+ if ((ret = _find_thread(pthread)) == 0)
/* Get the thread priority: */
- rval = pthread->pthread_priority;
+ ret = pthread->pthread_priority;
+ else {
+ /* Invalid thread: */
+ errno = ret;
+ ret = -1;
}
- /* Unblock signals: */
- _thread_kern_sig_unblock(status);
-
/* Return the thread priority or an error status: */
- return (rval);
+ return (ret);
}
#endif