diff options
author | rpj <rpj> | 2002-01-04 04:53:36 +0000 |
---|---|---|
committer | rpj <rpj> | 2002-01-04 04:53:36 +0000 |
commit | 6922362c66bbfaa3ac9b7bb6be24368d790d28d6 (patch) | |
tree | c63857fdc9b19e00bf29a07b246e3cdb7d603fd9 /attr.c | |
parent | 6f68e7b50e0bb837d02dc2cb8a7bc5887534d7b8 (diff) |
* 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.
Diffstat (limited to 'attr.c')
-rw-r--r-- | attr.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -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; |