diff options
author | David Leonard <d@cvs.openbsd.org> | 1999-01-17 23:57:17 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1999-01-17 23:57:17 +0000 |
commit | 209640f64878cc32de9cf45178c9a0e979525bdd (patch) | |
tree | ace3ae774387a2292430e4f360fe34337290b329 /lib/libpthread/uthread | |
parent | 4a7fc69d62f684a7548d428f1a09bcefbabe0b6f (diff) |
pthread_getschedparam() and pthread_setschedparam() stubs
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r-- | lib/libpthread/uthread/uthread_setprio.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/libpthread/uthread/uthread_setprio.c b/lib/libpthread/uthread/uthread_setprio.c index 87a50d0f5ba..7de34d3c7c1 100644 --- a/lib/libpthread/uthread/uthread_setprio.c +++ b/lib/libpthread/uthread/uthread_setprio.c @@ -29,11 +29,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: uthread_setprio.c,v 1.2 1999/01/06 05:29:26 d Exp $ + * $OpenBSD: uthread_setprio.c,v 1.3 1999/01/17 23:57:16 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE #include <pthread.h> +#include <sched.h> #include "pthread_private.h" int @@ -54,4 +55,34 @@ pthread_setprio(pthread_t pthread, int prio) /* Return the error status: */ return (ret); } + +int +pthread_getschedparam(thread, policy, param) + pthread_t thread; + int *policy; + struct sched_param *param; +{ + int ret = 0; + + if ((ret = _find_thread(thread)) == 0) { + if (policy) + *policy = SCHED_RR; + if (param) + param->sched_priority = thread->pthread_priority; + } + return (ret); +} + +int +pthread_setschedparam(thread, policy, param) + pthread_t thread; + int policy; + const struct sched_param *param; +{ + + if (policy == SCHED_RR) + return pthread_setprio(thread, param->sched_priority); + else + return (EINVAL); +} #endif |