thr_setprio.c (13546) | thr_setprio.c (22315) |
---|---|
1/* 2 * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 31 unchanged lines hidden (view full) --- 40{ 41 int rval = 0; 42 int status; 43 pthread_t pthread_p; 44 45 /* Check if the priority is invalid: */ 46 if (prio < PTHREAD_MIN_PRIORITY || prio > PTHREAD_MAX_PRIORITY) { 47 /* Return an invalid argument error: */ | 1/* 2 * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 31 unchanged lines hidden (view full) --- 40{ 41 int rval = 0; 42 int status; 43 pthread_t pthread_p; 44 45 /* Check if the priority is invalid: */ 46 if (prio < PTHREAD_MIN_PRIORITY || prio > PTHREAD_MAX_PRIORITY) { 47 /* Return an invalid argument error: */ |
48 _thread_seterrno(_thread_run, EINVAL); | 48 errno = EINVAL; |
49 rval = -1; 50 } else { 51 /* Block signals: */ 52 _thread_kern_sig_block(&status); 53 54 /* Point to the first thread in the list: */ 55 pthread_p = _thread_link_list; 56 57 /* Enter a loop to search for the thread: */ 58 while (pthread_p != NULL && pthread_p != pthread) { 59 /* Point to the next thread: */ 60 pthread_p = pthread_p->nxt; 61 } 62 63 /* Check if the thread pointer is NULL: */ 64 if (pthread == NULL || pthread_p == NULL) { 65 /* Return a 'search' error: */ | 49 rval = -1; 50 } else { 51 /* Block signals: */ 52 _thread_kern_sig_block(&status); 53 54 /* Point to the first thread in the list: */ 55 pthread_p = _thread_link_list; 56 57 /* Enter a loop to search for the thread: */ 58 while (pthread_p != NULL && pthread_p != pthread) { 59 /* Point to the next thread: */ 60 pthread_p = pthread_p->nxt; 61 } 62 63 /* Check if the thread pointer is NULL: */ 64 if (pthread == NULL || pthread_p == NULL) { 65 /* Return a 'search' error: */ |
66 _thread_seterrno(_thread_run, ESRCH); | 66 errno = ESRCH; |
67 rval = -1; 68 } else { 69 /* Set the thread priority: */ 70 pthread->pthread_priority = prio; 71 } 72 73 /* Unblock signals: */ 74 _thread_kern_sig_unblock(status); 75 } 76 77 /* Return the error status: */ 78 return (rval); 79} 80#endif | 67 rval = -1; 68 } else { 69 /* Set the thread priority: */ 70 pthread->pthread_priority = prio; 71 } 72 73 /* Unblock signals: */ 74 _thread_kern_sig_unblock(status); 75 } 76 77 /* Return the error status: */ 78 return (rval); 79} 80#endif |