From 6922362c66bbfaa3ac9b7bb6be24368d790d28d6 Mon Sep 17 00:00:00 2001 From: rpj Date: Fri, 4 Jan 2002 04:53:36 +0000 Subject: * attr.c (pthread_attr_setscope): Add more error checking and actually store the scope value even though it's not really necessary. (pthread_attr_getscope): Return stored value. * implement.h (pthread_attr_t_): Add new scope element. * ANNOUNCE: Fix out of date comment next to pthread_attr_setscope in conformance section. --- attr.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'attr.c') diff --git a/attr.c b/attr.c index 44976e3..21c3ddb 100644 --- a/attr.c +++ b/attr.c @@ -360,6 +360,7 @@ pthread_attr_init(pthread_attr_t *attr) */ attr_result->param.sched_priority = THREAD_PRIORITY_NORMAL; attr_result->inheritsched = PTHREAD_EXPLICIT_SCHED; + attr_result->contentionscope = PTHREAD_SCOPE_SYSTEM; attr_result->valid = PTW32_ATTR_VALID; @@ -515,12 +516,15 @@ int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope) { #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - if (contentionscope != PTHREAD_SCOPE_SYSTEM) - { - return ENOTSUP; - } - - return 0; + switch (contentionscope) { + case PTHREAD_SCOPE_SYSTEM: + attr->contentionscope = contentionscope; + return 0; + case PTHREAD_SCOPE_PROCESS: + return ENOTSUP; + default: + return EINVAL; + } #else return ENOSYS; #endif @@ -531,7 +535,7 @@ int pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope) { #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - *contentionscope = PTHREAD_SCOPE_SYSTEM; + *contentionscope = attr->contentionscope; return 0; #else return ENOSYS; -- cgit v1.2.3