Implement pthread_attr_{set,get}schedpolicy() at the same level as the other
scheduling stuff: only handle SCHED_OTHER. Like the rest of the scheduling stuff, this is for the benefit of code that can't be bothered to test against _POSIX_THREAD_PRIORITY_SCHEDULING.
This commit is contained in:
parent
0c386f944e
commit
fae5965c52
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pthread.h,v 1.19 2004/12/15 16:29:53 wiz Exp $ */
|
||||
/* $NetBSD: pthread.h,v 1.20 2004/12/29 00:59:57 nathanw Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -70,6 +70,8 @@ int pthread_attr_getschedparam(const pthread_attr_t *,
|
|||
struct sched_param *);
|
||||
int pthread_attr_setschedparam(pthread_attr_t *,
|
||||
const struct sched_param *);
|
||||
int pthread_attr_getschedpolicy(const pthread_attr_t *, int *);
|
||||
int pthread_attr_setschedpolicy(pthread_attr_t *, int);
|
||||
int pthread_attr_getscope(const pthread_attr_t *, int *);
|
||||
int pthread_attr_setscope(pthread_attr_t *, int);
|
||||
int pthread_attr_getstack(const pthread_attr_t *, void **, size_t *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pthread_attr.c,v 1.3 2003/11/09 18:56:48 christos Exp $ */
|
||||
/* $NetBSD: pthread_attr.c,v 1.4 2004/12/29 00:59:57 nathanw Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001,2002,2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: pthread_attr.c,v 1.3 2003/11/09 18:56:48 christos Exp $");
|
||||
__RCSID("$NetBSD: pthread_attr.c,v 1.4 2004/12/29 00:59:57 nathanw Exp $");
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
@ -267,6 +267,31 @@ pthread_attr_getschedparam(const pthread_attr_t *attr,
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
/*ARGSUSED*/
|
||||
pthread_attr_setschedpolicy(pthread_attr_t *attr,
|
||||
int policy)
|
||||
{
|
||||
|
||||
if (policy != SCHED_OTHER)
|
||||
return ENOTSUP;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
/*ARGSUSED*/
|
||||
pthread_attr_getschedpolicy(const pthread_attr_t *attr,
|
||||
int *policy)
|
||||
{
|
||||
|
||||
policy = SCHED_OTHER;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pthread_attr_getstack(const pthread_attr_t *attr, void **addr, size_t *size)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue