summaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
authorrpj <rpj>2002-01-04 04:53:36 +0000
committerrpj <rpj>2002-01-04 04:53:36 +0000
commit6922362c66bbfaa3ac9b7bb6be24368d790d28d6 (patch)
treec63857fdc9b19e00bf29a07b246e3cdb7d603fd9 /attr.c
parent6f68e7b50e0bb837d02dc2cb8a7bc5887534d7b8 (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.c18
1 files changed, 11 insertions, 7 deletions
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;